From cf5c95862ecea004df7a8f44b234a959ea8ea36f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 10 Jun 2024 09:16:53 -0500 Subject: [PATCH] fix(parser): Report correct num_args on too-few Fixes #5526 --- clap_builder/src/error/format.rs | 2 +- tests/builder/multiple_values.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clap_builder/src/error/format.rs b/clap_builder/src/error/format.rs index 601edde9bd1..0f8644f6adc 100644 --- a/clap_builder/src/error/format.rs +++ b/clap_builder/src/error/format.rs @@ -337,7 +337,7 @@ fn write_dynamic_context( let were_provided = singular_or_plural(*actual_num_values as usize); let _ = write!( styled, - "{}{min_values}{} more values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}", + "{}{min_values}{} values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}", valid.render(), valid.render_reset(), literal.render(), diff --git a/tests/builder/multiple_values.rs b/tests/builder/multiple_values.rs index ba04d296123..725f89069dc 100644 --- a/tests/builder/multiple_values.rs +++ b/tests/builder/multiple_values.rs @@ -259,7 +259,7 @@ fn option_min_less() { assert_eq!(err.kind(), ErrorKind::TooFewValues); #[cfg(feature = "error-context")] assert_data_eq!(err.to_string(), str![[r#" -error: 3 more values required by '-o