mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-21 22:07:14 +00:00
36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-edit guard: block vendor/lock files and secrets.d real fish files.
|
|
# Receives tool input JSON on stdin.
|
|
|
|
fp=$(jq -r '.tool_input.file_path // empty')
|
|
[ -z "$fp" ] && exit 0
|
|
|
|
case "$fp" in
|
|
*/fzf-tmux | */yarn.lock | */.yarn/*)
|
|
echo "BLOCKED: $fp is a vendor/lock file — do not edit directly" >&2
|
|
exit 2
|
|
;;
|
|
*/tools/dotbot/* | */tools/dotbot-include/* | */tools/antidote/*)
|
|
echo "BLOCKED: $fp is inside a git submodule — do not edit" >&2
|
|
exit 2
|
|
;;
|
|
*/config/tmux/plugins/*)
|
|
echo "BLOCKED: $fp is a tmux plugin submodule — do not edit" >&2
|
|
exit 2
|
|
;;
|
|
*/config/cheat/cheatsheets/community/* | */config/cheat/cheatsheets/tldr/*)
|
|
echo "BLOCKED: $fp is a cheat submodule — do not edit" >&2
|
|
exit 2
|
|
;;
|
|
*/secrets.d/*.fish)
|
|
case "$(basename "$fp")" in
|
|
*.example.fish | *.fish.example) exit 0 ;;
|
|
esac
|
|
echo "BLOCKED: do not edit $fp directly — it is gitignored." >&2
|
|
echo "Copy the matching .fish.example file and edit that locally." >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
exit 0
|