taskwarrior/scripts/hooks/on-exit
Dustin J. Mitchell cf6c0254dc
Add shell quoting and 'read -r' in example hooks (#3905)
This helps to avoid interpretation of escape sequences, such as
backslash-escapes, in these values.

Patch provided by @bughunter2 in https://github.com/GothenburgBitFactory/taskwarrior/issues/3899.
2025-06-26 15:34:43 +02:00

23 lines
410 B
Bash
Executable file

#!/bin/sh
# The on-exit event is triggered once, after all processing is complete.
# This hook script has no effect on processing.
# Input:
# - line of JSON for each modified task
# Output:
# - Optional feedback/error.
n=0
while read -r modified_task
do
n=$(($n + 1))
done
echo "on-exit: Counted $n added/modified tasks."
# Status:
# - 0: Non-JSON is feedback.
# - non-0: Non-JSON is error.
exit 0