From 8f687d6760a2f14cd2f872a85eed40c4992cf5a5 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 21 Jun 2025 22:25:53 +0200 Subject: [PATCH] feat(journal): initial sync --- journal.sh | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/journal.sh b/journal.sh index 9cc355b..c1bbaeb 100755 --- a/journal.sh +++ b/journal.sh @@ -3,22 +3,28 @@ # Load config . ${HOME}/.ayo.config -journal_dir="${notes_dir}/Journal" -month_dir=$(date +"%m %b") -file_name=$(date +'%m.%d.%Y').md -full_path="${journal_dir}/${month_dir}/${file_name}" +command=$1 -# IF Not Exists: create file & echo date -if ! test -f "$full_path"; then - install -Dv /dev/null "$full_path" - # TODO: update to correct heading from old entries - # Jun 17, 2025, Tue 10:24 PM - heading=$(date +'%b %d, %Y, %a %r') - echo $heading > "$full_path" +if [ "$1" = "sync" ]; then + echo 'sync' #TODO: git pull, git add ... git commit, git push +else + journal_dir="${notes_dir}/Journal" + month_dir=$(date +"%m %b") + file_name=$(date +'%m.%d.%Y').md + full_path="${journal_dir}/${month_dir}/${file_name}" + + # IF Not Exists: create file & echo date + if ! test -f "$full_path"; then + install -Dv /dev/null "$full_path" + # TODO: update to correct heading from old entries + # Jun 17, 2025, Tue 10:24 PM + heading=$(date +'%b %d, %Y, %a %r') + echo $heading > "$full_path" + fi + + # Open in editor + vim "$full_path" + + # Report; TODO: write log + echo ">>> " $full_path fi - -# Open in editor -vim "$full_path" - -# Report; TODO: write log -echo ">>> " $full_path