Compare commits

..

2 Commits

Author SHA1 Message Date
06ee4b76bb implemented config.sh in new_hook.sh and make_new.sh 2023-12-08 12:24:51 -06:00
0a103e24fa Added config.sh 2023-12-08 12:21:51 -06:00
3 changed files with 30 additions and 6 deletions

26
scripts/config.sh Normal file
View File

@ -0,0 +1,26 @@
#!/usr/local/bin/bash
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
function import () {
local SCRIPT_NAME="${1:?"import : script name not provided"}"
local SCRIPT_PATH=$UTILS_DIR/$SCRIPT_NAME
if [[ ! "$SCRIPT_PATH" =~ ^.*\.sh$ ]]; then
SCRIPT_PATH+=".sh"
fi
if [[ -f $SCRIPT_PATH ]]; then
. $SCRIPT_PATH
else
echo "import : $SCRIPT_PATH does not exist. Exiting program"
exit 1
fi
}

View File

@ -4,7 +4,7 @@ cd $JOURNAL_DIR
DATE=`date +'%Y-%m-%d'` DATE=`date +'%Y-%m-%d'`
FILE="$JOURNAL_DIR/$DATE.wiki" FILE="$JOURNAL_DIR/$DATE.wiki"
[[ -f $SCRIPT_DIR/utils/journals.sh ]] && . $SCRIPT_DIR/utils/journals.sh import journals
# Getting the last journal entry file # Getting the last journal entry file
declare -a journals declare -a journals

View File

@ -1,10 +1,8 @@
#!/usr/local/bin/bash #!/usr/local/bin/bash
export PROJECT_DIR=~/Notes cd `dirname $0`
export SCRIPT_DIR=$PROJECT_DIR/scripts
export JOURNAL_DIR=$PROJECT_DIR/wikis
cd $SCRIPT_DIR [[ -f config.sh ]] && . config.sh
./make_new.sh ./make_new.sh
./update_all.sh ./update_hook.sh