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

Flag and/or option fallback function #123

Closed
sasq64 opened this issue May 9, 2018 · 2 comments
Closed

Flag and/or option fallback function #123

sasq64 opened this issue May 9, 2018 · 2 comments
Labels

Comments

@sasq64
Copy link

sasq64 commented May 9, 2018

I want to parse special flags that begins with a dash and contains a single digit to mean compression levels for my zip like compression tool.

Right now I need to handle this with a special check inside a callback for positional arguments.

I would like to have something like:

opts.add_flag_fallback("-<digit>", [&](const char d) {
    compressionLevel = d - '0';
}, "Set compression level (0-9)");
@henryiii
Copy link
Collaborator

I'm thinking this could be a special type of add:

app.add_digit(Optional int value, "description");

@henryiii
Copy link
Collaborator

This is now possible!

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

No branches or pull requests

2 participants