Skip to content

Commit

Permalink
CommandWithArguments must use .multiple() instead of .multiple_values…
Browse files Browse the repository at this point in the history
…(), see clap-rs#2031
  • Loading branch information
intgr committed Jul 21, 2020
1 parent 44c4fde commit 0b3d8fb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clap_generate/examples/value_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn build_cli() -> App<'static> {
)
.arg(
Arg::new("command_with_args")
.multiple_values(true)
.multiple(true)
.value_hint(ValueHint::CommandWithArguments),
)
.arg(
Expand Down
2 changes: 1 addition & 1 deletion clap_generate/tests/value_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn build_app_with_value_hints() -> App<'static> {
)
.arg(
Arg::new("command_with_args")
.multiple_values(true)
.multiple(true)
.value_hint(ValueHint::CommandWithArguments),
)
.arg(
Expand Down
5 changes: 3 additions & 2 deletions src/build/arg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4233,8 +4233,9 @@ impl<'a> Arg<'a> {

if self.value_hint == ValueHint::CommandWithArguments {
assert!(
self.is_set(ArgSettings::MultipleValues),
"Argument '{}' uses hint CommandWithArguments and must accept multiple values",
self.is_set(ArgSettings::MultipleOccurrences)
&& self.is_set(ArgSettings::MultipleValues),
"Argument '{}' uses hint CommandWithArguments and must use .multiple(true)",
)
}
}
Expand Down

0 comments on commit 0b3d8fb

Please sign in to comment.