hk 1.45.0

A tool for managing git hooks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{Result, hook_options::HookOptions};

/// Sets up git hooks to run hk
#[derive(clap::Args)]
#[clap(visible_alias = "pc")]
pub struct PreCommit {
    #[clap(flatten)]
    hook: HookOptions,
}

impl PreCommit {
    pub async fn run(mut self) -> Result<()> {
        // pre-commit receives no arguments from git
        self.hook.tctx.insert("hook_args", "");
        self.hook.run("pre-commit").await
    }
}