Files
heartwood/scripts/just/install-hooks.sh
T
Lorenz Leutgeb c7d71df4ab scripts, build, just: POSIX Compliance
Enforce POSIX shell syntax with ShellCheck using `--shell sh`.
2026-10-30 12:45:40 +01:00

20 lines
391 B
Bash
Executable File

#! /usr/bin/env sh
set -e
HOOK_SCRIPT=$1
HOOKS=$2
printf "Overwrite existing hooks '%s'? [y/N] " "$HOOKS"
read -r confirm
[ "$confirm" = "y" ] || exit 1
for hook in $HOOKS; do
if [ -f ".git/hooks/$hook" ]; then
rm ".git/hooks/$hook"
fi
cp "$HOOK_SCRIPT" ".git/hooks/$hook"
chmod +x ".git/hooks/$hook"
done
echo ""
echo "${SUCCESS}Hooks installed: ${HOOKS}${NORMAL}"