- 🦀 Easily set up in your Rust project. No need to install additional package managers.
- ⚙️ Works with custom
build.rs
files. Automate the hooks installation process. - 💻 Run your hooks via CLI. Test your hooks without triggering them via Git.
Keep calm, monk will protect your repo!
You can install it using cargo
:
cargo install monk
You can add it as a build dependency:
cargo add --build monk
Then create a build.rs
file:
pub fn main() {
monk::init();
}
In this case, monk
will be installed automatically and will initialize all hooks from monk.yaml
.
This is the most convenient option for Rust projects, as it doesn't require contributors to install monk
manually.
You can also install monk
using Nix:
nix profile install github:daynin/monk
Create a configuration file named monk.yaml
in your project root:
pre-commit:
commands:
- cargo fmt -- --check
- cargo clippy -- -D warnings
pre-push:
commands:
- cargo test
If you installed monk
manually, run:
monk install
If you added it as a build dependency and set up build.rs
as shown above, the hooks will be installed automatically when you build your project.
To run specific hooks manually, use the run
command
monk run pre-commit
monk
automatically creates backup files for existing hooks and restores them when you remove monk's hooks.
To remove the hooks, run:
monk uninstall