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 4f14ea0ff1f..725f89069dc 100644 --- a/tests/builder/multiple_values.rs +++ b/tests/builder/multiple_values.rs @@ -176,7 +176,17 @@ fn option_exact_less() { .try_get_matches_from(vec!["", "-o", "val1", "-o", "val2"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind(), ErrorKind::WrongNumberOfValues); + let err = m.unwrap_err(); + assert_eq!(err.kind(), ErrorKind::WrongNumberOfValues); + #[cfg(feature = "error-context")] + assert_data_eq!(err.to_string(), str![[r#" +error: 3 values required for '-o