taskwarrior/test/test_hooks/on-add-reject
Dustin J. Mitchell 68cf122cea
Update hooks to use read -r and printf
This portably avoids any interpretation of backslash escapes by the
shell.
2025-07-02 15:36:43 -04:00

19 lines
445 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.
printf "%s\n" "$new_task"
echo 'FEEDBACK'
# Status:
# - 0: JSON accepted, non-JSON is feedback.
# - non-0: JSON ignored, non-JSON is error.
exit 1