feat: auto sync for notes & journal
This commit is contained in:
parent
8909dbe41e
commit
5fcf06c7aa
2 changed files with 31 additions and 32 deletions
|
|
@ -13,14 +13,13 @@ getopts "t" typora; #check if -t flag is given
|
|||
file_name=$(date +'%m.%d.%Y').md
|
||||
full_path="${journal_dir}/${month_dir}/${file_name}"
|
||||
|
||||
if [ "$1" = "sync" ]; then
|
||||
notesSync
|
||||
elif [ "$1" = "append" ]; then
|
||||
|
||||
if [ "$1" = "append" ]; then
|
||||
{
|
||||
read -p "Add thought: " thought
|
||||
time=$(date +'%r')
|
||||
echo $'\n'\> \[$time\]$'\n'\> $thought >> "$full_path"
|
||||
notesSync
|
||||
} || {
|
||||
echo ">>> Append failed"
|
||||
}
|
||||
|
|
@ -40,9 +39,10 @@ else
|
|||
else
|
||||
vim "$full_path"
|
||||
fi
|
||||
notesSync
|
||||
} || {
|
||||
# Report; TODO: write log
|
||||
echo ">>> " $full_path
|
||||
}
|
||||
fi
|
||||
|
||||
notesSync
|
||||
|
|
|
|||
7
notes.sh
7
notes.sh
|
|
@ -12,9 +12,8 @@ command=$1
|
|||
|
||||
getopts "t" typora; #check if -t flag is given
|
||||
|
||||
if [ "$1" = "sync" ]; then
|
||||
notesSync
|
||||
else
|
||||
|
||||
{
|
||||
read -p "Enter file name: " title
|
||||
file_name=$title.md
|
||||
|
|
@ -37,8 +36,8 @@ else
|
|||
vim "$full_path"
|
||||
fi
|
||||
|
||||
notesSync
|
||||
} || {
|
||||
echo ">>> New note failed"
|
||||
}
|
||||
fi
|
||||
|
||||
notesSync
|
||||
|
|
|
|||
Loading…
Reference in a new issue