3 releases
Uses new Rust 2024
new 0.1.2 | May 21, 2025 |
---|---|
0.1.1 | May 19, 2025 |
0.1.0 | May 18, 2025 |
#1167 in Command line utilities
300 downloads per month
12KB
185 lines
hookman
Add hooks to your Git repository using a TOML file.
Table of Contents
Key Features
- Automates the creation of multiple git hooks with just one TOML file.
- No symlinks, no additional
chmod +x
commands or perm-handling is needed.hookman
does it all for you. - Hooks event validation so that you don't accidentally write a wrong hook type.
- Tiny & fast; Made using Rust.
Usage
The usage is pretty straightforward.
When inside the directory of a Git repository, create a new hookman.toml
file with the following structure:
[hook.<event>] # the hook type/event (pre-commit, update etc.)
run = "<command>" # you can either have a `run` field with the command itself
script = "<script path>" # or, your personal script inside the directory
For example:
[hook.pre-commit]
run = "pip install -U -r requirements.txt && pip list > requirements.txt"
[hook.pre-push]
script = "scripts/bundle-app.sh"
- To put your hooks into action, run:
hookman build
# or use this command to use the current shell for hook execution later on
hookman build --use-current-shell
With this command, hookman
handles all script permissions, relocation and other mundane tasks without you ever having to touch it.
- To list all installed hooks, run:
hookman list
- To list all possible events a hook can be attached to, run:
hookman list-events
- And, to remove/clean all hooks:
hookman clean
Installation
Install using cargo
:
cargo install hookman
Or, you can set it up globally using mise
:
# Note: This will compile the binary for your system.
mise use -g cargo:hookman
For macOS, you can install using Homebrew:
brew install hitblast/tap/hookman
Manual Installation
If your platform isn't enlisted here, you can opt for the compressed binary downloads in the GitHub Releases section of the repository.
Note than on devices running macOS, you'll have to remove the quarantine attribute from the binary:
xattr -d com.apple.quarantine bin/hookman # inside extracted zip
Contributing
hookman is a very tiny project for those who'd like to use an extremely minimal setup for managing git hooks, so I don't think there is a need to follow a mandatory set of rules for contribution. Anyhow, pull requests, and new issues regarding feature suggestions, bug fixes or new ideas are always welcome!
License
Licensed under the MIT License. Please check LICENSE for more information.
Dependencies
~1.4–2.2MB
~41K SLoC