Allow possible_values to take string vector reference

Makes it more backward compatible and flexible
This commit is contained in:
Pavan Kumar Sunkara 2021-10-17 16:58:58 +01:00
parent d3b33953de
commit e63760e461
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

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