-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support to print usage explicitly or on error. #39
Comments
This is a good idea! Are you just asking for something you can call to display the help, or do you also want an easy way to enable help printing on error (like perhaps a "usageOnError" flag to |
I think it would be nice to have something like |
Any progress on this one? |
Sorry, no, I haven't had a chance to work on this one yet. I don't think it would be hard to implement though. If you're interested I'd be happy to review a pull request. I'm thinking a |
On any SystemExitException except for --help there is no obvious way I could find to print the help text.
In general on error I'd like to print the help text.
The best I could do was to recursively call main("--help") then some ugly code to prevent infinte recursion.
snippet:
Other libraries like JCommander, joptsimple etc provide some way to call the usage() method and/or some way to trigger it being displayed on an error.
The above code is embarrassingly ugly.
I attempted something slightly less ugly - to create a ShowHelpMessageException() but the constructor is internal, plus I don't have access to the parsed help values.
The text was updated successfully, but these errors were encountered: