Implement a version string

Add a `--version` and `-V` to the command to print out the version
This commit is contained in:
Alex Crichton
2018-03-01 19:19:12 -08:00
parent 36f064bed0
commit 1c8061e675
4 changed files with 41 additions and 2 deletions

View File

@ -134,3 +134,13 @@ pub fn name_to_descriptor(name: &str) -> char {
}
char::from_u32(ret).unwrap()
}
pub fn version() -> String {
let mut v = env!("CARGO_PKG_VERSION").to_string();
if let Some(s) = option_env!("WBG_VERSION") {
v.push_str(" (");
v.push_str(s);
v.push_str(")");
}
return v
}