-
-
Save linuxcaffe/60a773e359d46090d2da78ca7198f709 to your computer and use it in GitHub Desktop.
Taskwarrior hook that stops all active tasks when "task FILTER start" is run. PoC for https://bug.tasktools.org/browse/TW-1712
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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