Picocli: Separate reponsibilities of class property population and application execution

Before using a cli I would have a starter class which calls my ApplicationPropertiesProvider class (which reads my properties file) and then kicks off the business logic. So there was a separation, the ApplicationPropertiesProvider just had one job.Now with picocli, the guide/documentation states I have to use CommandLine.run(objectToPopulate, args) or CommandLine.call(objectToPopulate, args). Therefore the class being populated with the cli parameters (ApplicationPropertiesProvider) has to implement Runnable or Callable. Now I could just paste...Read more

How to reduce slow start for picocli apps due to reflection

Picocli has to introspect the command tree. Doing so it needs to load the domain object classes for every Command which slows down the jvm startup.What options are there to avoid this startup lag? One solution I've come up with is described in https://github.com/remkop/picocli/issues/482:I am using reflection to postpone any class loading until after the command is selected. This way only the command classes themselves are loaded and finally the classes which implement the single command requested by the user:abstract class BaseCommand implemen...Read more

display options for subcommands using PicoCLI

I am using PicoCLI v4.0.0-beta-1b. I am using different subcommands linked from a parent command. The parent command's optional parameters get displayed when I launch the CLI but not for the subcommands. The subcommands only appears underneath commands (but with no options).How does one go about to ensure that the options for subcommands appear in the CLI as well?Options: -a, --autocomplete Generate sample autocomplete -h, --help Display this help message. -v, --verbose Verbose mode. Helpful for troubleshooting. -V, --...Read more

Picocli option list alignment problem in usage-help message

I am using a command using PicoCLI v4.0.0-alpha-3. No matter which options I try, the one that shows at the top (when the list of options is displayed in the CL) is always to the right of the other options. How can this be configured so that all options for a command are aligned at the same level?@CommandLine.Command(name = "", description = "test", header = "%n@|green test|@", footer = {"", "@|cyan Press Ctrl-D to exit the CLI.|@", ""}, version = "1.0.0", showDefaultValues = tr...Read more

Picocli: can the parser be configured using annotations?

I use PicoCLI to parse the arguments. I need to specify setStopAtPositional(true) for one of the subcommands. Is there a way to do this with an annotation? Currently I do this:cmd.getSubcommands().get("submit").setStopAtPositional(true);But it would be better to specify it at the method where the submit command is specified to have entire specification in one place.My class has this structure:@Command(...)public class CommandLine implements Callable<Void> { @Command(...) public void submit( ... options) { }}...Read more

Can picocli subcommands have options with the same name?

I have a program that executes different types of statistical analysis. I would like to define a subcommand for each type of analysis. The parent command would be the main entry point into the program. I get an error message that says "option should be specified only once" when my subcommands have options with the same name. The problem seems to be how I am calling the subcommands. In the example below, input1 and input2 work correctly. When I try to use both subcommands simultaneously (input3), I get an error message.The code below demonstrate...Read more

Non-zero exit code on missing parameter with picocli

I have a simple Command with one mandatory parameter: @Parameters(index = "0", description = "manifest")private File manifest;When I call it from the command line without a parameter I get the expected message: Missing required parameter: <manifest>Usage ....BUT: the return code for the call to java is 0, implying everything went fine. Is there a way to have picocli return a non-zero code if a parameter (or option) is missing/incorrect?...Read more