feat(journal): sync command
This commit is contained in:
parent
b6b357a688
commit
67cdd47065
2 changed files with 17 additions and 3 deletions
3
ayo.sh
3
ayo.sh
|
@ -1,6 +1,9 @@
|
||||||
#! /usr/bin/bash
|
#! /usr/bin/bash
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
js)
|
||||||
|
. ${HOME}/Projects/scripts/journal.sh sync
|
||||||
|
;;
|
||||||
j | journal)
|
j | journal)
|
||||||
. ${HOME}/Projects/scripts/journal.sh $2 $3 $4 $5
|
. ${HOME}/Projects/scripts/journal.sh $2 $3 $4 $5
|
||||||
;;
|
;;
|
||||||
|
|
17
journal.sh
17
journal.sh
|
@ -4,12 +4,23 @@
|
||||||
. ${HOME}/.ayo.config
|
. ${HOME}/.ayo.config
|
||||||
|
|
||||||
command=$1
|
command=$1
|
||||||
|
journal_dir="${notes_dir}/Journal"
|
||||||
|
month_dir=$(date +"%m %b")
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "sync" ]; then
|
if [ "$1" = "sync" ]; then
|
||||||
echo 'sync' #TODO: git pull, git add ... git commit, git push
|
{
|
||||||
|
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
|
else
|
||||||
journal_dir="${notes_dir}/Journal"
|
|
||||||
month_dir=$(date +"%m %b")
|
|
||||||
file_name=$(date +'%m.%d.%Y').md
|
file_name=$(date +'%m.%d.%Y').md
|
||||||
full_path="${journal_dir}/${month_dir}/${file_name}"
|
full_path="${journal_dir}/${month_dir}/${file_name}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue