bular 0.0.2

CLI for managing Bular deployments
use std::process::{Command, Stdio};

fn main() {
    git_hash();
}

// TODO: Maybe remove this and do it with codegen so it works with `cargo install` properly
fn git_hash() {
    let output = Command::new("git")
        .args(["rev-parse", "--short", "HEAD"])
        .stdout(Stdio::null()) // TODO: Don't do this
        .stderr(Stdio::null()) // TODO: Don't do this
        .output()
        .expect("error getting git hash. Does `git rev-parse --short HEAD` work for you?");
    let git_hash = String::from_utf8(output.stdout)
        .expect("Error passing output of `git rev-parse --short HEAD`");
    if !output.status.success() {
        // panic!(
        //     "Error running `git rev-parse --short HEAD`. Got status {}",
        //     output.status
        // );
        // Will fail when doing `cargo install`
        println!("cargo:rustc-env=GIT_HASH=unknown");
    } else {
        println!("cargo:rustc-env=GIT_HASH={git_hash}");
    }
}