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

Option values cannot start with dash #709

Open
rwhit opened this issue Oct 29, 2020 · 3 comments
Open

Option values cannot start with dash #709

rwhit opened this issue Oct 29, 2020 · 3 comments

Comments

@rwhit
Copy link

rwhit commented Oct 29, 2020

I have an option to provide a key to a utility. The key value in one instance happens to start with "-". So running:

utitility.exe --key -gobbledygook123

produces an error message:

ERROR(S):
Option 'g' is unknown.
Required option 'key' is missing.

@rmunn
Copy link
Contributor

rmunn commented Feb 6, 2021

This has been fixed by a PR I made, which has been merged into develop and will be in release 2.9.0. Unfortunately that release was delayed by an expired NuGet API key, but #733 fixes that issue so the release will hopefully be soon.

@rmunn
Copy link
Contributor

rmunn commented Feb 6, 2021

In the meantime, you can work around this issue by telling users to use the = syntax, because utility.exe --key=-gobbledygook123 will do what you expect (the value of key will be -gobbledygook123 including the leading hyphen). Once 2.9.0 is released, then you'll be able to do:

var parser = new Parser(with => {
    with.ParserMode = ParserMode.GetoptParserV2;
});

And then --key -gobbledygook123 will do what you expect.

@rmunn
Copy link
Contributor

rmunn commented Feb 6, 2021

This is essentially a duplicate of #601, and is fixed by #684 and #690, which should be in the 2.9.0 release once it finally comes out.

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