add proper version string

This commit is contained in:
Dr. Matthias Ratajczak
2023-01-30 16:55:45 +01:00
parent b3d5aa0fce
commit b49e470b1d
5 changed files with 25 additions and 4 deletions
+11 -1
View File
@@ -136,7 +136,7 @@ impl Pacdef {
}
fn show_version(self) {
println!("pacdef, version: {}", env!("CARGO_PKG_VERSION"));
println!("{}", get_version_string());
}
fn show_unmanaged_packages(mut self) {
@@ -289,3 +289,13 @@ fn show_error(error: anyhow::Error, backend: Box<dyn Backend>) {
None => println!("WARNING: skipping backend '{section}': {error}"),
}
}
pub(crate) const fn get_version_string() -> &'static str {
concat!(
"pacdef, version: ",
env!("CARGO_PKG_VERSION"),
" (",
env!("GIT_HASH"),
")",
)
}