From c6567ee04bfff5de6b90cb93879873144120f5df Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Tue, 1 Jul 2025 10:31:09 -0700 Subject: [PATCH] Restored --version cli argument. Added a test for it --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- src/cli/global.rs | 5 +++-- tests/cli.rs | 10 ++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b4701..f7710fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. + +## [1.18.1] +- Restored --version cli argument +- Added test for the argument + ## [1.18.0] - Added rules for DeepSeek, xAI - Removed branding diff --git a/Cargo.toml b/Cargo.toml index 6a90c97..98fb1fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ publish = false [package] name = "kingfisher" -version = "1.18.0" +version = "1.18.1" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/src/cli/global.rs b/src/cli/global.rs index 37e0bbb..e8001a9 100644 --- a/src/cli/global.rs +++ b/src/cli/global.rs @@ -10,10 +10,11 @@ use crate::cli::commands::{ github::GitHubArgs, gitlab::GitLabArgs, rules::RulesArgs, scan::ScanArgs, }; + #[deny(missing_docs)] #[derive(Parser, Debug)] - -/// Kingfisher — Detect and validate secrets across files and full Git history +#[command(version = env!("CARGO_PKG_VERSION"))] +/// Kingfisher - Detect and validate secrets across files and full Git history pub struct CommandLineArgs { /// The command to execute #[command(subcommand)] diff --git a/tests/cli.rs b/tests/cli.rs index f1af007..0486b73 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -22,4 +22,14 @@ mod test { .success() .stdout(contains("kingfisher.aws.").and(contains("pattern"))); } + + #[test] + fn cli_version_flag() { + Command::cargo_bin("kingfisher") + .unwrap() + .arg("--version") + .assert() + .success() + .stdout(contains(env!("CARGO_PKG_VERSION"))); + } }