Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Taskwarrior hook that stops all active tasks when "task FILTER start" is run. PoC for https://bug.tasktools.org/browse/TW-1712
#!/usr/bin/env bash
# Stops all previously active tasks on "task FILTER start"
#
# Only pending tasks are checked/stopped. If you really want to stop
# started tasks that are completed/deleted, remove the status:pending
# filter. Note that this will decrease performance, and should not
# be necessary.
tw_command=""
for i in "$@"; do
if [ "${i:0:8}" == "command:" ]; then
tw_command="${i:8}"
break
fi
done
if [ "$tw_command" == "start" ]; then
for t in $(task status:pending +ACTIVE _uuids); do
task $t stop
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.