From 7860a205dbdc2287312b715a02f9e0b047a56dfd Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 19 Jul 2022 12:54:45 +0100 Subject: [PATCH] Use configuration constants in version cli command --- src/cli/version.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cli/version.rs b/src/cli/version.rs index e7750fee..c3b3f1f3 100644 --- a/src/cli/version.rs +++ b/src/cli/version.rs @@ -1,8 +1,7 @@ +use crate::cnf::PKG_NAME; +use crate::cnf::PKG_VERS; use crate::err::Error; -const NAME: &str = env!("CARGO_PKG_NAME"); -const VERSION: &str = env!("CARGO_PKG_VERSION"); - macro_rules! get_cfg { ($i:ident : $($s:expr),+) => ( let $i = || { $( if cfg!($i=$s) { return $s; } );+ "unknown"}; @@ -12,6 +11,6 @@ macro_rules! get_cfg { pub fn init(_: &clap::ArgMatches) -> Result<(), Error> { get_cfg!(target_os: "windows", "macos", "ios", "linux", "android", "freebsd", "openbsd", "netbsd"); get_cfg!(target_arch: "x86", "x86_64", "mips", "powerpc", "powerpc64", "arm", "aarch64"); - println!("{} {} for {} on {}", NAME, VERSION, target_os(), target_arch()); + println!("{} {} for {} on {}", PKG_NAME, PKG_VERS, target_os(), target_arch()); Ok(()) }