mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 14:52:33 +00:00
Allow possible_values to take string vector reference
Makes it more backward compatible and flexible
This commit is contained in:
parent
d3b33953de
commit
e63760e461
2 changed files with 7 additions and 1 deletions
|
@ -38,6 +38,12 @@ impl<'help> From<&'help str> for ArgValue<'help> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'help> From<&'help &'help str> for ArgValue<'help> {
|
||||||
|
fn from(s: &'help &'help str) -> Self {
|
||||||
|
Self::new(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Getters
|
/// Getters
|
||||||
impl<'help> ArgValue<'help> {
|
impl<'help> ArgValue<'help> {
|
||||||
/// Get the name of the argument value
|
/// Get the name of the argument value
|
||||||
|
|
|
@ -711,7 +711,7 @@ fn required_if_val_present_fail_error_output() {
|
||||||
Arg::new("target")
|
Arg::new("target")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true)
|
.required(true)
|
||||||
.possible_values(["file", "stdout"])
|
.possible_values(&["file", "stdout"])
|
||||||
.long("target"),
|
.long("target"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
Loading…
Reference in a new issue