Crate rhusky

Crate rhusky 

Source
Expand description

§Rhusky

Git hooks manager for Rust projects. Rhusky sets up Git’s core.hooksPath to point to your project’s hooks directory, enabling shared git hooks across your team.

Unlike similar tools, Rhusky is truly idempotent - it will never overwrite your existing hook scripts.

§Usage

Add rhusky to your build-dependencies:

[build-dependencies]
rhusky = "0.1"

Create a build.rs file:

fn main() {
    rhusky::Rhusky::new()
        .hooks_dir(".githooks")
        .install()
        .ok();
}

Create your hooks in .githooks/:

mkdir -p .githooks
echo '#!/bin/sh\ncargo fmt --check' > .githooks/pre-commit
chmod +x .githooks/pre-commit

§Features

  • Truly idempotent: Never overwrites existing hooks
  • No magic: Just sets core.hooksPath in git config
  • CI-aware: Skips installation in CI environments
  • Zero dependencies: Pure Rust, no external crates

Structs§

Rhusky
Builder for configuring and installing git hooks.