app rusty-hook

git hook utility

5 releases

✓ Uses Rust 2018 edition

new 0.4.1 Mar 14, 2019
0.4.0 Feb 12, 2019
0.1.2 Dec 27, 2018
0.1.1 Dec 27, 2018
0.1.0 Dec 27, 2018

#177 in Development tools

Download history 36/week @ 2018-12-25 7/week @ 2019-01-01 12/week @ 2019-01-08 7/week @ 2019-01-15 1/week @ 2019-01-22 1/week @ 2019-01-29 11/week @ 2019-02-12 3/week @ 2019-02-19 10/week @ 2019-02-26 1/week @ 2019-03-05

28 downloads per month

MIT license

39KB
965 lines

rusty-hook

Git hook utility for Rust codebases that lets you run any script for any git hook.

Functional, but still in Beta!

Version Badge Downloads Badge License Badge

Linux CI Badge Mac CI Badge Windows CI Badge

Test Results Badge Coverage Badge

Installing

The best way to install rusty-hook is to use cargo:

cargo install rusty-hook

Or add it as a dev dependency in your Cargo.toml file:

[dev-dependencies]
rusty-hook = "0.4.1"

Initialize

Run the init command in any git directory to set it up:

rusty-hook init

This will ensure that all of the client side git hooks are available, and it will create a rusty-hook configuration file if one does not already exist.

Configure

You define your desired git hook configuration in the rusty-hook configuration file (a TOML file named .rusty-hook.toml or rusty-hook.toml).

Here's an example rusty-hook configuration that leverages multiple git hooks, including the pre-commit and the pre-push hooks:

[hooks]
pre-commit = "cargo test"
pre-push = "cargo fmt -- --check"
post-commit = "echo yay"

[logging]
verbose = true

Hooks

Under the [hooks] table, you can add an entry for any and every git hook you want to run by adding a key using the name of the git hook, and then specify the command/script you want to run for that hook. Whenever that git hook is triggered, rusty-hook will run your specified command!

Logging

Under the [logging] table, you can control whether to log the output of running your specified hook commands. By default rusty-hook will log the results of your hook script, but you can disable this behavior by setting the verbose key to false:

[logging]
verbose = false

Alternatives

There's a few other git hook utilities available on crates.io, but none of them quite suited our needs so we made rusty-hook!

Contributions

All contributions are welcome and appreciated! Check out our Contributing Guidelines for more information about opening issues, developing, and more.

Dependencies

~1.5MB
~15K SLoC