Exit on help, version or invalid arguments
See original GitHub issueTypically, when you run a command line application using the help or version flag (--help
, --version
) you expect that the program exits itself after printing usage information.
Picocli has a built-in feature to alleviate the programmer of writing the help and version logic, but in this case Picocli doesn’t exit application —invoking for example system exit with a status code of success— but let the application to continue running.
When using the convenience CommandLine.run()
, CommandLine.call()
I would expect the described behavior to happen. Currently, usage information is printed but application doesn’t exit and continues running with no simple way to configure it to work as described (related discussion: #397 ).
I propose to print usage and exit to be the default behavior. I don’t know if any other use case could need the application to continue but in that case I would propose an annotation based configuration to override the defaults like the one proposed in ticket #397 .
Kind regards!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Glad to hear that. Sounds like you would like to see documentation on using picocli with Spring Boot. I don’t have any experience with Spring, so contributions / pull requests welcome!
About the original request: I like the idea of having annotations to control the exit code on usage help and version info, and I will probably add this in a future release.
Thanks @remkop , I cannot check it out at this moment, but I keep it present 😃