2020-10-18 09:22:13 +00:00
|
|
|
use std::process::Command;
|
|
|
|
|
2020-03-31 21:54:45 +00:00
|
|
|
fn main() {
|
2020-10-18 09:22:13 +00:00
|
|
|
let git_describe = Command::new("git")
|
2020-03-31 21:54:45 +00:00
|
|
|
.args(&["describe", "--tags", "--broken"])
|
|
|
|
.output()
|
|
|
|
.ok()
|
|
|
|
.and_then(|proc| String::from_utf8(proc.stdout).ok());
|
|
|
|
|
|
|
|
let version_info = match git_describe {
|
|
|
|
Some(description) if !description.is_empty() => description,
|
2021-02-01 18:41:07 +00:00
|
|
|
_ => format!("v{}", env!("CARGO_PKG_VERSION")),
|
2020-03-31 21:54:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
println!("cargo:rustc-env=ZOXIDE_VERSION={}", version_info);
|
|
|
|
}
|