Altered other scripts to implement config.sh

This commit is contained in:
Tristan Ancelet 2023-12-08 12:35:05 -06:00
parent 06ee4b76bb
commit 6990ca264d
7 changed files with 24 additions and 19 deletions

View File

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

View File

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

View File

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

View File

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

9
scripts/update_hook.sh Executable file
View File

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

View File

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

View File

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