The below mixture of 1 parent command with 1 sub-command with aliases fails to recognize subcommand aliases properly.
INPUT: cb t
Expected output:
Running Collabbook main command!
Create task
Actual output:
Unmatched argument: t
Usage: cb [-hV] [COMMAND]
Collaborate on tasks in your git repo from the terminal.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
task Create task
note Create note
MWE
@Command(description="Collaborate on tasks in your git repo from the terminal.",
name="cb", mixinStandardHelpOptions = true, version="")
public class Collabbook implements Callable<Void> {
public static void main(String[] args) {
CommandLine cmd = new CommandLine(new Collabbook())
.addSubcommand("task", new CreateTask());
List<Object> result = cmd.parseWithHandler(new RunAll(), args);
}
@Override
public Void call() throws Exception {
System.out.println("Running Collabbook main command!");
return null;
}
}
@Command(description="Create task", name="task", aliases={"t"})
public class CreateTask implements Callable<Void> {
@Override
public Void call() {
System.out.println("Create task");
return null;
}
}
Thanks for the bug report! I've been able to reproduce this problem. Looking into it.
Fixed in master.
I released picocli 3.5.2 that includes the fix for this issue. Enjoy!
Confirmed this works in 3.5.2
@remkop Thank you for being awesome.
馃槆
No worries.
Glad you like it!
Thanks again for the bug report!
Most helpful comment
I released picocli 3.5.2 that includes the fix for this issue. Enjoy!