2022-02-16 23:45:23 +00:00
|
|
|
use crate::err::Error;
|
2020-06-29 15:36:01 +00:00
|
|
|
|
2022-03-04 16:01:32 +00:00
|
|
|
const NAME: &str = env!("CARGO_PKG_NAME");
|
|
|
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
2020-06-29 15:36:01 +00:00
|
|
|
|
|
|
|
macro_rules! get_cfg {
|
|
|
|
($i:ident : $($s:expr),+) => (
|
|
|
|
let $i = || { $( if cfg!($i=$s) { return $s; } );+ "unknown"};
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
2021-03-29 15:43:37 +00:00
|
|
|
println!("{} {} for {} on {}", NAME, VERSION, target_os(), target_arch());
|
2020-06-29 15:36:01 +00:00
|
|
|
Ok(())
|
|
|
|
}
|