diff --git a/rust/migrate-wicked/build.rs b/rust/migrate-wicked/build.rs new file mode 100644 index 0000000000..cc9d01139b --- /dev/null +++ b/rust/migrate-wicked/build.rs @@ -0,0 +1,11 @@ +use std::process::Command; + +fn main() { + let output = Command::new("git") + .args(&["rev-parse", "HEAD"]) + .output() + .unwrap(); + let mut git_hash = String::from_utf8(output.stdout).unwrap(); + git_hash.truncate(9); + println!("cargo:rustc-env=GIT_HEAD={}", git_hash); +} diff --git a/rust/migrate-wicked/src/main.rs b/rust/migrate-wicked/src/main.rs index 991f10427d..4c2b19bb4e 100644 --- a/rust/migrate-wicked/src/main.rs +++ b/rust/migrate-wicked/src/main.rs @@ -17,7 +17,7 @@ use std::process::{ExitCode, Termination}; use tokio::sync::OnceCell; #[derive(Parser)] -#[command(name = "migrate-wicked", version, about, long_about = None)] +#[command(name = "migrate-wicked", version(concat!(env!("CARGO_PKG_VERSION"),"~",env!("GIT_HEAD"))), about, long_about = None)] struct Cli { #[clap(flatten)] global_opts: GlobalOpts,