Skip to content

Exit on help, version or invalid arguments #424

@gerardbosch

Description

@gerardbosch

Typically, 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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions