blob: 372d1f65494360904b0e8e4f3602a38a743380b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/env bash
block_target_command="$1"
actual_command="$(jq -r '.tool_input.command // ""')"
if ! printf '%s' "$actual_command" | grep -q "\\b${block_target_command}\\b"; then
exit 0
fi
case "$1" in
rm)
echo "The command 'rm' is denied. Use 'git rm' if the file or the directory is tracked by git. If not, request deletion to user. Do not attempt any other deletion methods like find -delete or python" >&2;;
esac
exit 2
|