1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
use anyhow::Result;
use devx_pre_commit::PreCommitContext;

pub fn run_hook() -> Result<()> {
    let ctx = PreCommitContext::from_git_diff(crate::project_root_dir())?;
    ctx.rustfmt()?;
    ctx.stage_new_changes()?;
    Ok(())
}

pub fn install_hook() -> Result<()> {
    devx_pre_commit::install_self_as_hook(crate::project_root_dir())?;
    Ok(())
}