picocli
picocli copied to clipboard
Reusing CommandLine object doesn't reset values in argument groups options.
The following test fails:
@Test
public void testReuseBothCommandLineAndUserObjectWithArgGroup() {
Command userObject = new Command();
CommandLine cmdLine = new CommandLine(userObject);
cmdLine.execute("--group", "group", "--option", "option");
cmdLine.execute();
assertNull(userObject.option, "Expected option to be reset to null");
assertNull(userObject.group.option, "Expected group option to be reset to null");
}
@Command(name = "command")
static class Command implements Runnable {
@Option(names = "--option")
private String option;
@ArgGroup
private Group group;
private static class Group {
@Option(names = "--group")
private String option;
}
@Override
public void run() {
}
}