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

Options without separating space consume positional arguments #90

Closed
rokups opened this issue Mar 25, 2018 · 2 comments
Closed

Options without separating space consume positional arguments #90

rokups opened this issue Mar 25, 2018 · 2 comments

Comments

@rokups
Copy link

rokups commented Mar 25, 2018

Consider this application:

    std::vector<std::string> options;
    std::string foo, bar;
    CLI::App app{"Test"};
    app.add_option("-O", options);
    app.add_option("foo", foo)->required();
    app.add_option("bar", bar)->required();
    CLI11_PARSE(app, argc, argv);

Following fails: ./test -OTest param1 param2
Error: bar is required

Following works: ./test -O Test param1 param2

It should either warn that -OTest is not a proper option instead of consuming param1 or accept -OTest with value Test.

henryiii added a commit that referenced this issue Mar 25, 2018
henryiii added a commit that referenced this issue Mar 25, 2018
henryiii added a commit that referenced this issue Mar 25, 2018
@henryiii
Copy link
Collaborator

It was a logic error for the "rest" part of a short option; it would not consider that in the always eat one calculation. Thanks!

PS: I will also add a test for --Opt=value while I'm thinking about it, just in case.

@rokups
Copy link
Author

rokups commented Mar 26, 2018

Thank you for the swift fix! By the way lib is simply awesome. Cant say that enough. 😄 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants