fix(parser): Report correct num_args on too-few

Fixes #5526
This commit is contained in:
Ed Page 2024-06-10 09:16:53 -05:00
parent e0c9619c27
commit cf5c95862e
2 changed files with 3 additions and 3 deletions

View file

@ -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(),

View file

@ -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 <option> <option> <option>...'; only 2 were provided
error: 3 values required by '-o <option> <option> <option>...'; only 2 were provided
Usage: multiple_values [OPTIONS]
@ -603,7 +603,7 @@ fn positional_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 '[pos] [pos] [pos]...'; only 2 were provided
error: 3 values required by '[pos] [pos] [pos]...'; only 2 were provided
Usage: myprog [pos] [pos] [pos]...