From 46746c0ab04af7dcb6611794f693860144293f52 Mon Sep 17 00:00:00 2001 From: Chris Simpkins Date: Mon, 20 Nov 2023 22:04:58 -0500 Subject: [PATCH] add print_verbose_version function to support verbose debug version reporting --- fontc/src/main.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/fontc/src/main.rs b/fontc/src/main.rs index 397e44ab8..e18f974e0 100644 --- a/fontc/src/main.rs +++ b/fontc/src/main.rs @@ -22,6 +22,12 @@ fn main() { } fn run() -> Result<(), Error> { + let args = Args::parse(); + // handle `--vv` verbose version argument request + if args.verbose_version { + print_verbose_version(); + std::process::exit(0); + } let mut timer = JobTimer::new(Instant::now()); let time = create_timer(AnyWorkId::InternalTiming("Init logger"), 0) .queued() @@ -46,7 +52,6 @@ fn run() -> Result<(), Error> { let time = create_timer(AnyWorkId::InternalTiming("Init config"), 0) .queued() .run(); - let args = Args::parse(); let (ir_paths, be_paths) = init_paths(&args)?; let config = Config::new(args)?; let prev_inputs = config.init()?; @@ -85,3 +90,28 @@ fn run() -> Result<(), Error> { write_font_file(&config.args, &be_root) } + +fn print_verbose_version() { + println!( + "{} {} @ {}\n", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + env!("VERGEN_GIT_SHA") + ); + println!("{}", env!("VERGEN_RUSTC_HOST_TRIPLE")); + println!( + "rustc {} (channel: {})", + env!("VERGEN_RUSTC_SEMVER"), + env!("VERGEN_RUSTC_CHANNEL") + ); + println!("llvm {}", env!("VERGEN_RUSTC_LLVM_VERSION")); + match env!("VERGEN_CARGO_DEBUG") { + "true" => println!("cargo profile: debug"), + "false" => println!("cargo profile: release"), + _ => (), + }; + println!( + "cargo optimization level: {}", + env!("VERGEN_CARGO_OPT_LEVEL") + ); +}