taskwarrior/scripts/hooks/on-add
Dustin J. Mitchell 03ec490913
Add shell quoting and 'read -r' in example hooks
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-23 16:35:04 -04:00

19 lines
434 B
Bash
Executable file

#!/bin/sh
# The on-add event is triggered separately for each task added. This hook
# script can accept/reject the addition. Processing will continue.
# Input:
# - Line of JSON for proposed new task.
read -r new_task
# Output:
# - JSON, modified or unmodified.
# - Optional feedback/error.
echo "$new_task"
echo 'on-add'
# Status:
# - 0: JSON accepted, non-JSON is feedback.
# - non-0: JSON ignored, non-JSON is error.
exit 0