Skip to content

Commit

Permalink
feat: Show build type (debug/release) in --version
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick888 committed Oct 23, 2023
1 parent 71ac529 commit acd322f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@ fn long_version() -> &'static str {
features.push("yubikey".to_owned());
}
if features.is_empty() {
version
#[cfg(debug_assertions)]
let version = format!("{version} [debug]");
#[cfg(not(debug_assertions))]
let version = format!("{version} [release]");
Box::leak(Box::new(version)).as_str()
} else {
let features = features.join(", ");
let version = format!("{version} ({features})");
#[cfg(debug_assertions)]
let version = format!("{version} [debug] ({features})");
#[cfg(not(debug_assertions))]
let version = format!("{version} [release] ({features})");
Box::leak(Box::new(version)).as_str()
}
}
Expand Down

0 comments on commit acd322f

Please sign in to comment.