diff --git a/scripts/config.sh b/scripts/config.sh index 85697b7..83a8fe7 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -1,12 +1,13 @@ #!/usr/local/bin/bash - +export CONFIG=1 export PROJ_DIR=~/Notes export JOURNAL_DIR=$PROJ_DIR/wikis export SCRIPT_DIR=$PROJ_DIR/scripts export FILES_DIR=$PROJ_DIR/files export SUBJECTS_DIR=$PROJ_DIR/subjects export UTILS_DIR=$SCRIPT_DIR/utils +export SITE_NAV='[[/index.wiki|Index]] [[/full_index.wiki|Full Index]] [[/tasks.wiki|Tasks Index]] [[/how-to.wiki|How-To Index]] [[/subjects.wiki|Subjects]]' function import () { local SCRIPT_NAME="${1:?"import : script name not provided"}" @@ -24,3 +25,5 @@ function import () { fi } + +export -f import diff --git a/scripts/make_new.sh b/scripts/make_new.sh index 772fc55..f0b0d94 100755 --- a/scripts/make_new.sh +++ b/scripts/make_new.sh @@ -1,5 +1,6 @@ #!/opt/homebrew/bin/bash +[[ $CONFIG -ne 1 ]] && [[ -f config.sh ]] && . config.sh cd $JOURNAL_DIR DATE=`date +'%Y-%m-%d'` FILE="$JOURNAL_DIR/$DATE.wiki" @@ -39,7 +40,7 @@ echo "[[$LAST_JOURNAL_ENTRY|Last Journal Entry]] %title $DATE Journal Entry --------------------- -[[/index.wiki|Index]] +$SITE_NAV --------------------- Main Topics from previous journal entry diff --git a/scripts/update_all.sh b/scripts/update_all.sh deleted file mode 100755 index 32c66c2..0000000 --- a/scripts/update_all.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/opt/homebrew/bin/bash -export PROJ_DIR=~/Notes -export JOURNAL_DIR=$PROJ_DIR/wikis -export FILES_DIR=$PROJ_DIR/files -export SCRIPT_DIR=$PROJ_DIR/scripts - -cd $PROJ_DIR - -for script in $SCRIPT_DIR/enabled/**; do - [[ -x $script ]] && $script -done diff --git a/scripts/update_full_index.sh b/scripts/update_full_index.sh index 63d50f1..507337c 100755 --- a/scripts/update_full_index.sh +++ b/scripts/update_full_index.sh @@ -1,8 +1,7 @@ #!/opt/homebrew/bin/bash -#set -x - -[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh +[[ $CONFIG -ne 1 ]] && [[ -f config.sh ]] && . config.sh +import journals JOURNAL_FULL_INDEX=$PROJ_DIR/full_index.wiki declare -a journals diff --git a/scripts/update_hook.sh b/scripts/update_hook.sh new file mode 100755 index 0000000..408ed9e --- /dev/null +++ b/scripts/update_hook.sh @@ -0,0 +1,9 @@ +#!/opt/homebrew/bin/bash + +[[ -f config.sh ]] && [[ $CONFIG -ne 1 ]] && . config.sh + +cd $PROJ_DIR + +for script in $SCRIPT_DIR/enabled/**; do + [[ -x $script ]] && $script +done diff --git a/scripts/update_index.sh b/scripts/update_index.sh index 5b5528e..fcc0c58 100755 --- a/scripts/update_index.sh +++ b/scripts/update_index.sh @@ -1,15 +1,17 @@ #!/opt/homebrew/bin/bash -[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh -JOURNAL_INDEX=$PROJ_DIR/index.wiki +[[ $CONFIG -ne 1 ]] && [[ -f config.sh ]] && . config.sh +import journals + +JOURNAL_INDEX=$PROJ_DIR/index.wiki declare -a journals get_journals journals echo " %title Journal Index ----------------------------------------------- -[[/index.wiki|Index]] [[full_index.wiki|Full Index]] [[tasks.wiki|Tasks Index]] [[how-to.wiki|How-To Index]] +$SITE_NAV ----------------------------------------------- Journals diff --git a/scripts/update_tasks.py b/scripts/update_tasks.py index 4f1e011..8bbbadf 100755 --- a/scripts/update_tasks.py +++ b/scripts/update_tasks.py @@ -6,6 +6,7 @@ import os PROJ_DIR=Path(os.getenv("PROJ_DIR")) TASK_FILE=PROJ_DIR/"tasks.wiki" +NAV=os.getenv("SITE_NAV") if not TASK_FILE.exists(): TASK_FILE.touch() @@ -17,6 +18,7 @@ else: with TASK_FILE.open('a') as file: file.write("%title Tasks\n\n\n") + file.write(f"{NAV}\n") for fileobj in get_journal(): filename = fileobj.name