diff --git a/Cargo.lock b/Cargo.lock index 8535af2cc..1a509b12d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.8" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9394150f5b4273a1763355bd1c2ec54cc5a2593f790587bcd6b2c947cfa9211" +checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" dependencies = [ "clap_builder", "clap_derive", @@ -311,9 +311,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.8" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a78fbdd3cc2914ddf37ba444114bc7765bbdcb55ec9cbe6fa054f0137400717" +checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" dependencies = [ "anstream", "anstyle", diff --git a/src/cli_util.rs b/src/cli_util.rs index 257561aec..bd1b0d18a 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -2279,8 +2279,14 @@ fn handle_early_args( args: &[String], layered_configs: &mut LayeredConfigs, ) -> Result<(), CommandError> { - // ignore_errors() bypasses errors like "--help" or missing subcommand - let early_matches = app.clone().ignore_errors(true).try_get_matches_from(args)?; + // ignore_errors() bypasses errors like missing subcommand + let early_matches = app + .clone() + .disable_version_flag(true) + .disable_help_flag(true) + .disable_help_subcommand(true) + .ignore_errors(true) + .try_get_matches_from(args)?; let mut args: EarlyArgs = EarlyArgs::from_arg_matches(&early_matches).unwrap(); if let Some(choice) = args.color {