taskwarrior/scripts/hooks/on-add.the
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

12 lines
236 B
Bash

#!/usr/bin/env bash
read -r new_task
if (printf "%s" "$new_task" | grep -qE '[tT]eh');
then
new_task=$(printf "%s" "$new_task" | sed -r 's/([tT])eh/\1he/g')
echo "Auto-corrected 'teh' --> 'the'"
fi
printf "%s" "$new_task"
exit 0