Skip to content

Incorrect help message for boolean options with arity 1 #612

@prewersk

Description

@prewersk

If we print help for the following example command

@Command(mixinStandardHelpOptions = true)
public class ExampleCommand {

  @Option(names = { "-b" }, arity = "1")
  boolean booleanWithArity1;

}

the message looks like this

Usage: <main class> [-hVb]
  -b=<booleanWithArity1>
  -h, --help                Show this help message and exit.
  -V, --version             Print version information and exit.

As we expect value for the '-b' option, I think that usage line should look like

Usage: <main class> [-hV] [-b=<booleanWithArity1>]

The problem does not occur when we define only a name with double '-' for such an option.

@Command(mixinStandardHelpOptions = true)
public class ExampleCommand {

  @Option(names = { "--b" }, arity = "1")
  boolean booleanWithArity1;

}
Usage: <main class> [-hV] [--b=<booleanWithArity1>]
      --b=<booleanWithArity1>

  -h, --help      Show this help message and exit.
  -V, --version   Print version information and exit.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions