From 8a57017af3a82837f28caa285b9650bb3353a910 Mon Sep 17 00:00:00 2001 From: Steffen Eiden Date: Mon, 1 Dec 2025 14:27:57 +0100 Subject: [PATCH] rust/utils: Add s390-tools version macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new macro allows (rust) tools reporting the s390-tools version string via clap functionalities, instead of implementing that on their own. That clap interface requires a string and not a void function that prints the version string. Define a macro that provides this string. Reviewed-by: Jan Höppner Signed-off-by: Steffen Eiden --- rust/utils/src/lib.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/rust/utils/src/lib.rs b/rust/utils/src/lib.rs index c14b5183..68a1b43a 100644 --- a/rust/utils/src/lib.rs +++ b/rust/utils/src/lib.rs @@ -48,15 +48,21 @@ macro_rules! release_string { }}; } +#[macro_export] +macro_rules! tools_version_fmt { + ($year: expr) => { + format!( + "version {}\nCopyright IBM Corp. {}", + $crate::release_string!(), + $year + ) + }; +} + #[macro_export] macro_rules! __print_version { ($year: expr, $verbosity: expr $( ,$feat: expr)?) => {{ - println!( - "{} version {}\nCopyright IBM Corp. {}", - env!("CARGO_PKG_NAME"), - $crate::release_string!(), - $year, - ); + println!("{} {}", env!("CARGO_PKG_NAME"), $crate::tools_version_fmt!($year)); if $verbosity > $crate::LevelFilter::Warn { $($feat.iter().for_each(|f| print!("{f} ")); println!("(compiled)");)? }