config/todo/actions/@ (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/usr/bin/env bash
export TODOTXT_VERBOSE=0
action=$1
shift
if [[ $action == "usage" ]]; then
echo "@ [context]"
echo " Lists all tasks with the given context."
echo " If no context is given, lists all tasks categorized by their context."
echo " If task has @someday, it won't be listed."
exit 0
fi
CONTEXTS=$(grep -o '[^ ]*@[^ ]\+' "$TODO_FILE" | grep '^@' | sort -u | sed 's/^@//g' )
for context in $CONTEXTS ; do
if [[ $context == "someday" ]]; then
continue
fi
CONTEXT_LIST=$(_list "$TODO_FILE" "@$context\b" "$@" | sed 's/\ *@[a-zA-Z0-9._\-]*\ */ /g')
if [[ -n "${CONTEXT_LIST}" ]]; then
echo -e "--@${context}"
echo "${CONTEXT_LIST}" | eval "$TODOTXT_FINAL_FILTER"
fi
done
|