refactor: notesSync steps in all scripts
This commit is contained in:
parent
651bd95adb
commit
99b657d15a
4 changed files with 19 additions and 13 deletions
3
ayo.sh
3
ayo.sh
|
@ -23,6 +23,9 @@ case $1 in
|
||||||
. ${HOME}/Projects/scripts/tasks.sh done $2 $3 $4 $5 $6 $7 $8 $9
|
. ${HOME}/Projects/scripts/tasks.sh done $2 $3 $4 $5 $6 $7 $8 $9
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
ns) # Notes sync
|
||||||
|
. ${HOME}/Projects/scripts/notes.sh sync
|
||||||
|
;;
|
||||||
nl) # Notes list
|
nl) # Notes list
|
||||||
. ${HOME}/Projects/scripts/notes.sh list $2 $3 $4 $5 $6 $7 $8 $9
|
. ${HOME}/Projects/scripts/notes.sh list $2 $3 $4 $5 $6 $7 $8 $9
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -40,8 +40,7 @@ if [ "$1" = "append" ]; then
|
||||||
{
|
{
|
||||||
read -p "Add thought: " thought
|
read -p "Add thought: " thought
|
||||||
time=$(date +'%r')
|
time=$(date +'%r')
|
||||||
echo $'\n'\> \[$time\]$'\n'\> $thought >> "$full_path"
|
echo $'\n'\> $thought \[$time\] >> "$full_path"
|
||||||
|
|
||||||
} || {
|
} || {
|
||||||
echo ">>> Append failed"
|
echo ">>> Append failed"
|
||||||
}
|
}
|
||||||
|
|
15
notes.sh
15
notes.sh
|
@ -55,12 +55,16 @@ function createNote() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## SYNC notes in directory
|
||||||
|
if [ "$1" = "sync" ] || [ "$1" = "s" ]; then
|
||||||
|
notesSync
|
||||||
|
|
||||||
## LIST notes in directory
|
## LIST notes in directory
|
||||||
if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
elif [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
echo "ACTIVE NOTES: "
|
echo "ACTIVE NOTES: "
|
||||||
|
notesSync
|
||||||
files=( $notes_dir/*.md )
|
files=( $notes_dir/*.md )
|
||||||
index=0
|
index=0
|
||||||
notesSync
|
|
||||||
for file in "${files[@]##*/}"; do
|
for file in "${files[@]##*/}"; do
|
||||||
((index++))
|
((index++))
|
||||||
echo "$index) $file"
|
echo "$index) $file"
|
||||||
|
@ -68,17 +72,16 @@ if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
|
|
||||||
## OPEN a note from a list
|
## OPEN a note from a list
|
||||||
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
|
notesSync
|
||||||
files=( $notes_dir/*.md )
|
files=( $notes_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
open_file=${files[$index]}
|
open_file=${files[$index]}
|
||||||
editFile "$open_file"
|
editFile "$open_file"
|
||||||
notesSync
|
|
||||||
else
|
else
|
||||||
PS3="Open file #: "
|
PS3="Open file #: "
|
||||||
echo "Please select a file to OPEN."
|
echo "Please select a file to OPEN."
|
||||||
notesSync
|
|
||||||
select file in "${files[@]##*/}"; do
|
select file in "${files[@]##*/}"; do
|
||||||
{
|
{
|
||||||
echo "Opening $file"
|
echo "Opening $file"
|
||||||
|
@ -94,8 +97,8 @@ elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
|
|
||||||
## REMOVE a note from a list
|
## REMOVE a note from a list
|
||||||
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
||||||
files=( $notes_dir/*.md )
|
|
||||||
notesSync
|
notesSync
|
||||||
|
files=( $notes_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
|
@ -122,8 +125,8 @@ elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
||||||
|
|
||||||
## ARCHIVE a note from a list
|
## ARCHIVE a note from a list
|
||||||
elif [ "$1" = "archive" ] || [ "$1" = "a" ]; then
|
elif [ "$1" = "archive" ] || [ "$1" = "a" ]; then
|
||||||
files=( $notes_dir/*.md )
|
|
||||||
notesSync
|
notesSync
|
||||||
|
files=( $notes_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
|
|
11
tasks.sh
11
tasks.sh
|
@ -59,9 +59,9 @@ function createtask() {
|
||||||
## LIST tasks in directory
|
## LIST tasks in directory
|
||||||
if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
echo "ACTIVE TASKS: "
|
echo "ACTIVE TASKS: "
|
||||||
|
notesSync
|
||||||
files=( $tasks_dir/*.md )
|
files=( $tasks_dir/*.md )
|
||||||
index=0
|
index=0
|
||||||
notesSync
|
|
||||||
for file in "${files[@]##*/}"; do
|
for file in "${files[@]##*/}"; do
|
||||||
((index++))
|
((index++))
|
||||||
echo "$index) $file"
|
echo "$index) $file"
|
||||||
|
@ -69,17 +69,16 @@ if [ "$1" = "list" ] || [ "$1" = "l" ]; then
|
||||||
|
|
||||||
## OPEN a task from a list
|
## OPEN a task from a list
|
||||||
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
|
notesSync
|
||||||
files=( $tasks_dir/*.md )
|
files=( $tasks_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
open_file=${files[$index]}
|
open_file=${files[$index]}
|
||||||
editFile "$open_file"
|
editFile "$open_file"
|
||||||
notesSync
|
|
||||||
else
|
else
|
||||||
PS3="Open file #: "
|
PS3="Open file #: "
|
||||||
echo "Please select a file to OPEN."
|
echo "Please select a file to OPEN."
|
||||||
notesSync
|
|
||||||
select file in "${files[@]##*/}"; do
|
select file in "${files[@]##*/}"; do
|
||||||
{
|
{
|
||||||
echo "Opening $file"
|
echo "Opening $file"
|
||||||
|
@ -95,12 +94,14 @@ elif [ "$1" = "open" ] || [ "$1" = "o" ]; then
|
||||||
|
|
||||||
## MARK AS DONE a task from a list
|
## MARK AS DONE a task from a list
|
||||||
elif [ "$1" = "done" ] || [ "$1" = "d" ]; then
|
elif [ "$1" = "done" ] || [ "$1" = "d" ]; then
|
||||||
files=( $tasks_dir/*.md )
|
|
||||||
notesSync
|
notesSync
|
||||||
|
files=( $tasks_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
done_file=${files[$index]}
|
done_file=${files[$index]}
|
||||||
|
read -p "Resolution: " resolution
|
||||||
|
echo $resolution >> "$done_file"
|
||||||
mv "$done_file" "${tasks_dir}/done/"
|
mv "$done_file" "${tasks_dir}/done/"
|
||||||
notesSync
|
notesSync
|
||||||
else
|
else
|
||||||
|
@ -121,8 +122,8 @@ elif [ "$1" = "done" ] || [ "$1" = "d" ]; then
|
||||||
|
|
||||||
## REMOVE a task from a list
|
## REMOVE a task from a list
|
||||||
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
elif [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
|
||||||
files=( $tasks_dir/*.md )
|
|
||||||
notesSync
|
notesSync
|
||||||
|
files=( $tasks_dir/*.md )
|
||||||
|
|
||||||
if ! [ "$2" = "" ]; then
|
if ! [ "$2" = "" ]; then
|
||||||
index=($2-1)
|
index=($2-1)
|
||||||
|
|
Loading…
Reference in a new issue