From db2ba424ce7996b6bd873420191b0c8f8c7c3faa Mon Sep 17 00:00:00 2001 From: DevBroco <84507903+BroccoliFin@users.noreply.github.com> Date: Wed, 25 Feb 2026 16:25:07 +0300 Subject: [PATCH] Add --version flag with clap built-in support and test (#342) Co-authored-by: firat.sertgoz --- src/cli/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index ee0ede9f..05995a87 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -166,3 +166,18 @@ impl Cli { matches!(self.command, None | Some(Command::Run)) } } + +#[cfg(test)] +mod tests { + use super::*; + use clap::CommandFactory; + + #[test] + fn test_version() { + let cmd = Cli::command(); + assert_eq!( + cmd.get_version().unwrap_or("unknown"), + env!("CARGO_PKG_VERSION") + ); + } +}