rvimage 0.6.0

A remote image viewer with a labeling tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::process::Command;

fn git_cmd(args: &[&str]) -> Option<String> {
    Command::new("git")
        .args(args)
        .output()
        .ok()
        .map(|o| String::from_utf8(o.stdout).unwrap())
}

fn main() {
    let git_desc = git_cmd(&["describe"]).unwrap_or_default();
    let is_dirty = git_cmd(&["diff"]).map(|o| !o.trim().is_empty()) == Some(true);

    println!("cargo:rustc-env=GIT_DESC={git_desc}");
    println!("cargo:rustc-env=GIT_DIRTY={is_dirty}");
}