From db1e22c6065efd5a3e6eb2827d116cc0de210c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=BCrr?= <102963075+cd-work@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:44:55 +0000 Subject: [PATCH] Fix certificate check option naming (#1546) This fixes an inconsistency between the `ignore_certs` configuration option and the `--no-check-certificate` CLI flag by changing the CLI flag to be `--ignore-certs` with an alias for the old version. Closes #480. --- cli/src/app.rs | 5 +++-- cli/src/bin/phylum.rs | 2 +- cli/src/config.rs | 2 +- cli/tests/common.rs | 2 +- docs/commands/phylum.md | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cli/src/app.rs b/cli/src/app.rs index 17db5db0a..70e007eec 100644 --- a/cli/src/app.rs +++ b/cli/src/app.rs @@ -51,9 +51,10 @@ pub fn app() -> Command { .long("timeout") .value_name("TIMEOUT") .help("Set the timeout (in seconds) for requests to the Phylum api"), - Arg::new("no-check-certificate") + Arg::new("ignore-certs") .action(ArgAction::SetTrue) - .long("no-check-certificate") + .long("ignore-certs") + .alias("no-check-certificate") .help("Don't validate the server certificate when performing api requests"), Arg::new("org") .short('o') diff --git a/cli/src/bin/phylum.rs b/cli/src/bin/phylum.rs index 630bdead8..eb18fa2ca 100644 --- a/cli/src/bin/phylum.rs +++ b/cli/src/bin/phylum.rs @@ -103,7 +103,7 @@ async fn handle_commands() -> CommandResult { let mut config = config::load_config(&matches)?; - config.set_ignore_certs_cli(matches.get_flag("no-check-certificate")); + config.set_ignore_certs_cli(matches.get_flag("ignore-certs")); if config.ignore_certs() { log::warn!("Ignoring TLS server certificate verification per user request."); } diff --git a/cli/src/config.rs b/cli/src/config.rs index 6be168be3..2410c6cfa 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -83,7 +83,7 @@ impl Config { self.ignore_certs_cli || self.ignore_certs } - /// Set the CLI `--no-check-certificate` override value. + /// Set the CLI `--ignore-certs` override value. pub fn set_ignore_certs_cli(&mut self, ignore_certs_cli: bool) { self.ignore_certs_cli = ignore_certs_cli; } diff --git a/cli/tests/common.rs b/cli/tests/common.rs index 2b903a80d..b58d97397 100644 --- a/cli/tests/common.rs +++ b/cli/tests/common.rs @@ -193,7 +193,7 @@ impl<'a> TestExtension<'a> { } #[cfg(feature = "extensions")] -impl<'a> Drop for TestExtension<'a> { +impl Drop for TestExtension<'_> { fn drop(&mut self) { self.test_cli.run(["extension", "uninstall", "test-ext"]).success(); fs::remove_dir_all(&self.extension_path).unwrap(); diff --git a/docs/commands/phylum.md b/docs/commands/phylum.md index 9a133ea40..1040404e3 100644 --- a/docs/commands/phylum.md +++ b/docs/commands/phylum.md @@ -17,7 +17,7 @@ Usage: phylum [OPTIONS] [COMMAND] `-t`, `--timeout` ``   Set the timeout (in seconds) for requests to the Phylum api -`--no-check-certificate` +`--ignore-certs`   Don't validate the server certificate when performing api requests `-o`, `--org` ``