2023-12-08 18:07:31 +00:00
|
|
|
#!/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
|
|
|
|
}
|