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

unexpected MissingParameterException when a help-option is supplied #128

Closed
waacc-gh opened this issue May 24, 2017 · 5 comments
Closed
Milestone

Comments

@waacc-gh
Copy link

The example from chapter 2.3, extended by an help-option (e.g. -?), fails if just the help-option is supplied:

@Parameters(hidden = true)  // "hidden": don't show this parameter in usage help message
List<String> allParameters; // no "index" attribute: captures _all_ arguments (as Strings)

@Parameters(index = "0")    InetAddress  host;
@Parameters(index = "1")    int          port;
@Parameters(index = "2..*") File[]       files;

@Option(names = "-?", help = true) boolean help;  // <-- added

Called just with "-?" leads to:
Exception in thread "main" picocli.CommandLine$MissingParameterException: Missing required parameter: port

@remkop
Copy link
Owner

remkop commented May 24, 2017

Thanks for the bug report! Investigating...

remkop added a commit that referenced this issue May 24, 2017
@remkop
Copy link
Owner

remkop commented May 24, 2017

Tracked it down to over-eager validation. This is now fixed in master.

@remkop
Copy link
Owner

remkop commented May 24, 2017

I released picocli v0.9.6 for this.
Thanks again for the bug report!

@remkop remkop closed this as completed May 24, 2017
@remkop remkop added this to the 0.9.6 milestone May 24, 2017
@waacc-gh
Copy link
Author

Thanks for the fixing quickly.
And thanks for the nice tool - helps me much.

@remkop
Copy link
Owner

remkop commented May 24, 2017

Glad to hear that!
If you like this project please star it on GitHub and tell your friends! :-)

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

No branches or pull requests

2 participants