mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 15:27:16 +00:00
fix(assert): Call out the action in positional assert
Brought up in #5135
This commit is contained in:
parent
cb2d2bcf07
commit
221177b9cb
2 changed files with 3 additions and 2 deletions
|
@ -746,8 +746,9 @@ fn assert_arg(arg: &Arg) {
|
|||
);
|
||||
assert!(
|
||||
arg.is_takes_value_set(),
|
||||
"Argument '{}` is positional, it must take a value{}",
|
||||
"Argument '{}` is positional and it must take a value but action is {:?}{}",
|
||||
arg.get_id(),
|
||||
arg.get_action(),
|
||||
if arg.get_id() == Id::HELP {
|
||||
" (`mut_arg` no longer works with implicit `--help`)"
|
||||
} else if arg.get_id() == Id::VERSION {
|
||||
|
|
|
@ -1730,7 +1730,7 @@ fn issue_2229() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic = "Argument 'pos` is positional, it must take a value"]
|
||||
#[should_panic = "Argument 'pos` is positional and it must take a value but action is SetTrue"]
|
||||
fn disallow_positionals_without_values() {
|
||||
let cmd = Command::new("test").arg(Arg::new("pos").num_args(0));
|
||||
cmd.debug_assert();
|
||||
|
|
Loading…
Add table
Reference in a new issue