mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-29 00:53:23 +02:00

* 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
21 lines
428 B
Bash
Executable file
21 lines
428 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Input:
|
|
# - Line of JSON for proposed new task.
|
|
read -r new_task
|
|
|
|
if (printf "%s\n" "$new_task" | grep -qE '[tT]eh');
|
|
then
|
|
new_task=$(printf "%s\n" "$new_task" | sed -r 's/([tT])eh/\1he/g')
|
|
fi
|
|
|
|
# Output:
|
|
# - JSON, modified
|
|
# - 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 0
|