argh icon indicating copy to clipboard operation
argh copied to clipboard

Vec with default does not work

Open leshow opened this issue 4 years ago • 0 comments

You can't have a repeated option with a default it looks like:

#[derive(FromArgs, PartialEq, Debug, Clone)]
/// Foo
#[argh(description = "foo")]
pub struct TestArgs {
    /// test repeated with default
    #[argh(option, default = "default_param_req()")]
    pub param: Vec<String>,
}

fn default_param_req() -> Vec<String> { 
    vec!["foo".to_string(), "bar".to_string()] 
}

fails with:

the trait bound `std::vec::Vec<String>: std::str::FromStr` is not satisfied

leshow avatar Jan 23 '22 22:01 leshow