Added a new install-precommit subcommand that installs a git pre-commit hook, prompting or accepting --global/--repo flags to control scope and configuring the hook to run kingfisher --quiet --only-valid --no-update-check

This commit is contained in:
Mick Grove 2025-08-22 17:33:03 -07:00
commit 7f3846c8e7
2 changed files with 3 additions and 3 deletions

View file

@ -96,7 +96,7 @@ make all # builds for every OS and architecture supported
### Install as a Git pre-commit hook
Run `kingfisher precommit --install` to set up a Git pre-commit hook that runs
`kingfisher --quiet --only-valid --no-update-check` before each commit.
`kingfisher scan --quiet --only-valid --no-update-check` before each commit.
Use `--global` to operate on all repositories or `--repo` to target only the
current repository without prompting. Remove the hook with
`kingfisher precommit --remove`.

View file

@ -214,9 +214,9 @@ fn hook_content() -> String {
fn hook_call_line() -> String {
if cfg!(windows) {
"kingfisher --quiet --only-valid --no-update-check %*".to_string()
"kingfisher scan --quiet --only-valid --no-update-check %*".to_string()
} else {
"kingfisher --quiet --only-valid --no-update-check \"$@\"".to_string()
"kingfisher scan --quiet --only-valid --no-update-check \"$@\"".to_string()
}
}