-
I can't get #[derive(Debug, Clap)]
#[clap(name = "cmd", setting = AppSettings::TrailingVarArg)]
pub struct Cmd {
// I tried this, but this doesn't work:
// #[clap(multiple = true, parse(from_str))]
pub args: Vec<String>,
} cmd --arg some -p text Can someone tell me how to use it? |
Beta Was this translation helpful? Give feedback.
Answered by
olvyko
Nov 19, 2020
Replies: 1 comment
-
I managed to get this to work, needed to add the #[derive(Debug, Clap)]
#[clap(setting = AppSettings::TrailingVarArg, setting = AppSettings::AllowLeadingHyphen)]
pub struct Cmd {
#[clap(multiple = true)]
pub args: Vec<String>,
} cmd --arg some -p text
# args: ["--arg", "some", "-p", "text"] |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
olvyko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I managed to get this to work, needed to add the
AllowLeadingHyphen
settingcmd --arg some -p text # args: ["--arg", "some", "-p", "text"]