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

Hybrid flag/option #124

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

Hybrid flag/option #124

sasq64 opened this issue May 9, 2018 · 2 comments

Comments

@sasq64
Copy link

sasq64 commented May 9, 2018

I would like to have support for options that can act as flags if no argument is given.
These options would require the forms -Xsomething or --longer=something when used as options.

opts.add_hybrid_option("--sign", stringValue, "Sign archive with specified key or default if none given", "defaultKey");

if(stringValue != "") {
  // Perfom signing
}

Should print help text such as;
--sign[=TEXT]

@henryiii
Copy link
Collaborator

Just thinking:

This is almost possible currently if you set the min/max allowed options to 0/1, respectively. The requirement of the special forms could be added as an "allowed forms" type option, with flags. Something like: ->allowed_short_form(CLI::NoSpace)->allowed_long_form(CLI::Equals).

@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants