garbage 0.4.3

CLI tool for interacting with the freedesktop trashcan
Documentation
use std::env;
use std::process::Command;

fn get_git_hash() -> Option<String> {
  let output = Command::new("git")
    .args(&["rev-parse", "--short", "HEAD"])
    .output()
    .ok()?;
  String::from_utf8(output.stdout).ok()
}

fn main() {
  if !env::var("GARBAGE_VERSION").is_ok() {
    if let Some(hash) = get_git_hash() {
      println!("cargo:rustc-env=GARBAGE_VERSION={}", hash);
    } else {
      println!("cargo:rustc-env=GARBAGE_VERSION=dirty");
    }
  }
}