Skip to content

Flags with multiple values wrongly consumes following positional arguments #1610

Answered by CreepySkeleton
althonos asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to implement the CLI as you described, you should use number_of_values

App::new("cksfv.rs")
    .arg(Arg::with_name("g")
        .short("g")
        .value_name("path")
        .takes_value(true)
        .multiple(true)
        .number_of_values(1))
    .arg(Arg::with_name("file")
        .index(1)
        .value_name("file")
        .multiple(true))

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pksunkara
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants