Files
prompts/script/install-precommit
T
clawbot 11245b85ca
check / check (push) Successful in 1m41s
script/install-precommit: write the hook through $hook (closes #139)
The script set hook and then repeated the path literally, so shellcheck
reported the variable as unused (SC2034).

Model: opus-5-5
2026-11-15 14:23:52 +01:00

17 lines
413 B
Bash
Executable File

#!/bin/sh
# script/install-precommit: install the git pre-commit hook that runs
# script/precommit. Our own extension to scripts-to-rule-them-all.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
main() {
cd "$ROOT"
hook=".git/hooks/pre-commit"
printf '#!/bin/sh\nset -e\nscript/precommit\n' > "$hook"
chmod +x "$hook"
echo "pre-commit hook installed: runs script/precommit"
}
main "$@"