git_hooks 0.1.1

A simple cargo build script to copy a hooks folder into .git/hooks so that your developers are all running the same git hooks
Documentation
use std::process::Command;
use std::env;
use std::path::Path;

fn main() {
    let manifest_dir = env::var("PWD")
        .expect("Failed to get working directory");
    let manifest_path = Path::new(&manifest_dir);

    let real_hooks_path = manifest_path.join(Path::new("hooks"));
    let git_hooks_path = manifest_path.join(".git").join("hooks");

    let real_dir = real_hooks_path.to_str().unwrap();
    let git_dir = git_hooks_path.to_str().unwrap();

    let cmd = &format!("rm -rf {git} && ln -s {real} {git}", git=git_dir, real=real_dir);

    Command::new("sh")
        .arg("-c")
        .arg(cmd)
        .output()
        .unwrap_or_else(|e| panic!("Failed to create symbolic links: {:?}", e));
}