Skip to content

When using "help <SubCommand>", the exit code is 0, despite exitCodeOnUsageHelp = ExitCode.USAGE #2355

@marco-brandizi

Description

@marco-brandizi

The title says almost all: I have a CLI app that is arranged as main command + subcommands. When I issue something like: java MainCommand help subCommand, the OS exit code is 0, not 2, despite both MainCommand.class and SubCommand are annotated with:

@Command ( ... exitCodeOnUsageHelp = ExitCode.USAGE, exitCodeOnVersionHelp = ExitCode.USAGE)

when doing java MainCommand -h, it exits with 2 as expected. Unless I'm missing something, to me it is a bug.

Until this is changed, it's possible to write a workaround like: in the static main(), check if the first argument is 'help'.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions