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

Multi-valued options not working? #343

Closed
mgalgs opened this issue Nov 13, 2015 · 4 comments
Closed

Multi-valued options not working? #343

mgalgs opened this issue Nov 13, 2015 · 4 comments
Labels
A-parsing Area: Parser's logic and needs it changed somehow. C-bug Category: Updating dependencies

Comments

@mgalgs
Copy link

mgalgs commented Nov 13, 2015

Maybe I'm missing something, but I can't get multi-valued options working.

#[macro_use]
extern crate clap;

use clap::{App};

fn main() {
    let matches = App::new("clap-test")
        .arg_from_usage("--print=<something>... 'Print stuff'")
        .get_matches();

    for thing in matches.values_of("something").unwrap() {
        println!("stuff: {}", thing);
    }
}

which outputs:

$ ./target/debug/clap-test --print hello
error: The following required arguments were not supplied:

USAGE:
    clap-test [FLAGS] --print <something>...

For more information try --help

Which required arguments is it complaining about?

The help text looks roughly correct:

$ ./target/debug/clap-test --help
clap-test 

USAGE:
    clap-test [FLAGS] --print <something>...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --print <something>...    Print stuff

Full repro project here: https://github.com/mgalgs/clap-test

@kbknapp
Copy link
Member

kbknapp commented Nov 13, 2015

Strange, I'll look into this. I think I know where the issue is, and is related to the major refactor we just had. This should be an easy fix, thanks for taking the time to file this! 👍

@kbknapp kbknapp added C-bug Category: Updating dependencies P1: urgent A-parsing Area: Parser's logic and needs it changed somehow. labels Nov 13, 2015
@kbknapp
Copy link
Member

kbknapp commented Nov 13, 2015

#344 fixes this issue. Once it merges I'll publish 1.5.1 to crates.io 😉

@kbknapp
Copy link
Member

kbknapp commented Nov 13, 2015

@mgalgs this issue has been fixed, v1.5.1 is out on crates.io. Thanks again for reporting the issue!

@mgalgs
Copy link
Author

mgalgs commented Nov 13, 2015

Wow, thanks for the quick turnaround! And thanks for the great library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parsing Area: Parser's logic and needs it changed somehow. C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants