cargo: upgrade clap from 4.3.8 to 4.3.9

The new version has a change that makes `ignore_errors()` not ignore
the error from `--help` (clap handles `--help` by returning an
error). To compensate for that, I disabled the `--help` and
`--version` flag and the `help` subcommand while parsing early
arguments.
This commit is contained in:
Martin von Zweigbergk 2023-06-28 12:29:56 -07:00 committed by Martin von Zweigbergk
parent 9995415440
commit 68e696d673
2 changed files with 12 additions and 6 deletions

8
Cargo.lock generated
View file

@ -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",

View file

@ -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 {