Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arg::last should allow preceding argument to be Arg::multiple(true) #896

Closed
nagisa opened this issue Mar 12, 2017 · 2 comments
Closed

Arg::last should allow preceding argument to be Arg::multiple(true) #896

nagisa opened this issue Mar 12, 2017 · 2 comments
Labels
C-bug Category: Updating dependencies

Comments

@nagisa
Copy link

nagisa commented Mar 12, 2017

In current master a Arg::last(true) is available which makes a positional argument of the form:

[-- <ARG>...]

possible. This argument is required to have the leading dash-dash before it can be parsed. This means that essentially any other positional argument should be possible before the dash-dash, including another Arg::multiple(true) argument, however currently clap panics:

thread 'main' panicked at 'When using a positional argument with .multiple(true) that is *not the last* positional argument, the last positional argument (i.e the one with the highest index) *must* have .required(true) or .last(true) set.', /home/nagisa/.cargo/git/checkouts/clap-rs-507f2c09c9b0886e/814b126/src/app/parser.rs:459

for code like this:

            .arg(Arg::with_name("CORPUS").multiple(true))
            .arg(Arg::with_name("ARGS").multiple(true).last(true))
@kbknapp
Copy link
Member

kbknapp commented Mar 12, 2017

good catch! I'll have it fixed momentarily!

@kbknapp kbknapp added C: args C-bug Category: Updating dependencies labels Mar 12, 2017
@homu homu closed this as completed in 9a3bc98 Mar 12, 2017
@kbknapp
Copy link
Member

kbknapp commented Mar 12, 2017

This is fixed in 2.21.1 on crates.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants