Automated_Journal_VimWiki/scripts/update_index.sh
2023-08-29 12:01:57 -05:00

28 lines
537 B
Bash
Executable File

#!/usr/bin/bash
#set -x
JOURNAL_DIR=/home/tristan/Journal
JOURNAL_SCRIPT_DIR=$JOURNAL_DIR/scripts
[[ -f $JOURNAL_SCRIPT_DIR/utils/journals.sh ]] && . $JOURNAL_SCRIPT_DIR/utils/journals.sh
JOURNAL_INDEX=$JOURNAL_DIR/index.wiki
declare -a journals
get_journals journals
echo "
%title Journal Index
[[full_index.wiki|Full Index]]
[[tasks.wiki|Tasks Index]]
[[how-to.wiki|How-To Index]]
# Journals
$(
for journal in ${journals[@]}; do
echo "- [[$journal|$( echo $journal | cut -d'.' -f 1 | tr '-' ' ')]]"
done
)
" > $JOURNAL_INDEX