Oliver
Oliver

Reputation: 4183

Implementing --help for subcommands

I have an application with a lot of subcommands and I would like allow the user to get via --help a help message for each subcommand. Although, it works, but not as good as I would like to get it.

java --jar application-0.0.1-SNAPSHOT.jar status -h
Unknown option: '-h'
Usage: application status
Checks if the application server status
Exit codes:
  0     Application server is running
  10    Application server is not running

I get the help, but not because I called it with the option -h. Instead it take the option -h as an error.

So, what is my current implementation missing?

@Command(name = "asStatus", description = "Checks if the application server status",
        exitCodeListHeading = "Exit codes:%n",
        exitCodeList = {
                CommonExitCodes.OK + ": Application server is running",
                AsCommandExitCodes.AS_NOT_RUNNING + ": Application server is not running"
        }
)
public class StatusCommand implements Callable<Integer> { 
}

Upvotes: -1

Views: 18

Answers (1)

Oliver
Oliver

Reputation: 4183

Ok, my fault, I missed the attribute mixinStandardHelpOptions to the annotation Command.

Upvotes: 0

Related Questions