Automated_Journal_VimWiki/scripts/utils/topics.sh

17 lines
401 B
Bash
Raw Permalink Normal View History

#!/opt/homebrew/bin/bash
[[ -f ~/Notes/utils/journals.sh ]] && . ~/Notes/utils/journals.sh
2023-06-14 19:15:13 +00:00
function get_tasks () {
local -a journals
get_journals journals
local TOPIC_REGEX='^=== .+ ==='
declare -n TOPICS="$1"
for journal in "${journals[@]}"; do
if grep -E "$TOPIC_REGEX" $journal >/dev/null 2>&1; then
TOPICS["$journal"]="$( grep -Eo "$TOPIC_REGEX" $journal | tr '=' ' ' )"
fi
done
}