taskwarrior/test/test_hooks/on-add-misbehave2
Dustin J. Mitchell c639cc030d
Fix and test handling of backslashes in hooks (#3909)
* Update hooks to use `read -r` and `printf`

This portably avoids any interpretation of backslash escapes by the
shell.

* Support running make_tc_task elsewhere

* Add a test for backslashes in task descriptions
2025-07-08 08:40:34 +02:00

17 lines
403 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.
# Status:
# - 0: JSON accepted, non-JSON is feedback.
# - non-0: JSON ignored, non-JSON is error.
exit 0