Skip to content

Confusing usage message for collection options #186

@AlexFalappa

Description

@AlexFalappa

The following test app:

@CommandLine.Command(name = "app")
public class App {

    @CommandLine.Option(names = "-n", paramLabel = "NAME", description = "list of names", type = String.class/*, arity = "1..*"*/)
    List<String> names = new LinkedList<>();

    public static void main(String[] args) {
        App app = new App();
        CommandLine cl = new CommandLine(app);
        cl.usage(System.out);
    }

}

Produces:

Usage: app [-n[=NAME...]]
  -n= =NAME...]               list of names

It would be better something like this:

Usage: app [-n[=NAME...]]
  -n= [NAME [NAME...]]               list of names

Interestingly uncommenting the arity specification produces a better usage:

Usage: app [-n=NAME [NAME...]]
  -n= NAME [NAME...]          list of names

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions