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

Repeatable required option fails to parse with one value #44

Open
afranchuk opened this issue Feb 21, 2020 · 0 comments
Open

Repeatable required option fails to parse with one value #44

afranchuk opened this issue Feb 21, 2020 · 0 comments

Comments

@afranchuk
Copy link

Right from the README quick reference, trying to use repeatable(required("-l") & value("lines", ids)) fails to parse correctly, where the parsing_result considers the required value as a missing argument:

#include "clipp.h"
#include <iostream>

int main(int argc, char *argv[])
{
    using namespace clipp;

    std::vector<size_t> ids;

    auto cli = repeatable(required("-l") & value("lines", ids));
    auto result = parse(argc, argv, cli);
    if (!result) {
        debug::print(std::cerr, result);
        return 1;
    }
    return 0;
}

Result of running:

$ ./a.out -l 0
#1 -l -> -l 
#2 0 -> lines 
lines    [missing after 0]

Note that more than one argument (e.g., ./a.out -l 0 -l 1) parses correctly.

afranchuk added a commit to afranchuk/clipp that referenced this issue Feb 21, 2020
This allows repeatable required options to have a single argument.
afranchuk added a commit to afranchuk/clipp that referenced this issue Feb 21, 2020
This allows repeatable required options to have a single argument.
afranchuk added a commit to afranchuk/clipp that referenced this issue Feb 21, 2020
This allows repeatable required options to have a single argument.
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

1 participant