jcommander
jcommander copied to clipboard
Commands with no description have the string "null" printed as their description when calling usage()
Steps to reproduce:
public class DescriptionIssue {
static class Command {
@Parameter(names = "-t")
private String test;
}
public static void main(String[] args) {
JCommander jCommander = JCommander.newBuilder().addCommand("testCommand", new Command()).build();
jCommander.usage();
}
}
The jCommander.usage() call above will result in the String literal "null" being printed instead of any description. Below I have copied the result of running that main method:
Usage: <main class> [command] [command options]
Commands:
testCommand null
Usage: testCommand [options]
Options:
-t
Instead of printing "null" it should either print nothing as the description or raise an error that the command doesn't have a description
By the way, I'm using version 1.78 for this.