I am using Pico CLI v4.0.0-alpha-3 & jline v3. I have the following class (using annotations). When I run the main class, I cannot seem to run the command and get the callable invoked. I can invoke the callable if I simply pass in the parameters.
@CommandLine.Command(name = "Test CLI",
description = "CLI tool",
header = "%n@|green test cli |@",
footer = {"",
"@|cyan Press Ctrl-D to exit the CLI.|@",
""},
version = "1.0.0",
showDefaultValues = true,
optionListHeading = "@|bold %nOptions|@:%n",
subcommands = {
Sync.class,
Status.class
})
public class Tester implements Callable<Integer> {
private static final String PROMPT = "Test CLI> ";
private LineReaderImpl lineReader;
private PrintWriter out;
@Option(names = {"-u", "--username"}, required = true, description = "user name")
private String userName;
@Option(names = {"-p", "--password"}, required = true, description = "password")
private String password;
final Tester tester = new Tester();
final CommandLine cmd = prepareCommand(tester);
final int exitCode = cmd.execute(args);
When I run the java application, and run the command with the parameters, the callable does not get invoked. When I simply pass in the parameters, the callable gets invoked. Any thoughts on how to fix this so that the CLI user has to pass in the command followed by the parameters.