feat(journal): sync command

This commit is contained in:
Ayo Ayco 2025-06-22 15:28:58 +02:00
parent b6b357a688
commit 67cdd47065
2 changed files with 17 additions and 3 deletions

3
ayo.sh
View file

@ -1,6 +1,9 @@
#! /usr/bin/bash
case $1 in
js)
. ${HOME}/Projects/scripts/journal.sh sync
;;
j | journal)
. ${HOME}/Projects/scripts/journal.sh $2 $3 $4 $5
;;

View file

@ -4,12 +4,23 @@
. ${HOME}/.ayo.config
command=$1
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")
if [ "$1" = "sync" ]; then
{
path="${journal_dir}/${month_dir}/"
cd "$path"
git pull
git add .
git commit -m "[script] update/add entrie/s"
git push
} || {
# Report; TODO: write log
echo ">>> Sync failed"
}
else
file_name=$(date +'%m.%d.%Y').md
full_path="${journal_dir}/${month_dir}/${file_name}"