-
Notifications
You must be signed in to change notification settings - Fork 420
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
Automatically print usage/version when help option specified on command line #161
Comments
Potential problemUsers want to either execute the command or ask for help about the command, but not both. How can we avoid doing both? If
Is this a good trade-off?This raises the question whether it is really a good idea to automatically print usage help/version info... BeforeThe objective was to allow application authors to omit code like
AfterAfter adding a bunch of code: two annotation attributes (
or
This does not seem like an improvement... ConclusionPerhaps
|
That said, adding a |
A commonly requested feature ( #151, #145 ) is to automatically print usage help when an option annotated with the
help=true
attribute was specified on the command line. However, the semantics of the@Option(help=true)
attribute is only to stop validation (to prevent "missing required option" errors). Picocli doesn't know whether to print usage help or version information, for example.#145 introduced two new
@Option
attributes:usageHelp
andversionHelp
.This ticket proposes two additional
@Command
attributes:autoPrintHelp
version
The
version
attribute is a string, intended to be used by Command authors to specify version information. TheCommandLine
class will have an additional methodcommandVersion(PrintStream)
that prints the version information from the annotated domain object to the specified stream.The
autoPrintHelp
attribute is an enum with values:OFF
,STDOUT
andSTDERR
.Example usage:
The text was updated successfully, but these errors were encountered: