feat: auto sync for notes & journal

This commit is contained in:
Ayo Ayco 2025-06-23 14:34:00 +02:00
parent 8909dbe41e
commit 5fcf06c7aa
2 changed files with 31 additions and 32 deletions

View file

@ -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
notesSync
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

View file

@ -12,10 +12,9 @@ command=$1
getopts "t" typora; #check if -t flag is given
if [ "$1" = "sync" ]; then
notesSync
else
{
notesSync
{
read -p "Enter file name: " title
file_name=$title.md
full_path="${notes_dir}/${file_name}"
@ -37,8 +36,8 @@ else
vim "$full_path"
fi
notesSync
} || {
} || {
echo ">>> New note failed"
}
fi
}
notesSync