-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Command Parser Feature request #2079
Comments
Hi @sdelamo, interesting idea. The proposal seems a bit limited in its application, only returning the class of the command that would be executed may only serve a limited number of use cases. |
Note that the existing ParseResult pr = new CommandLine(new MainCommand()).parseArgs(args);
List<CommandLine> subcommands = pr.asCommandLineList();
CommandLine toBeExecuted = subcommands.get(subcommands.size() - 1); // the last command in the list
Object userObject = toBeExecuted.getCommand();
Class<?> commandToBeExecuted = userObject.getClass(); |
This is in relation to micronaut-projects/micronaut-picocli#20 If we could now the command being executed without instantiating the commands (which we don't want since they are subject to dependency injection and they will be instantiated later), we maybe able to allow the user to provide additional configuration per command before starting the Micronaut application context. |
I’ve taken a look but the changes to accomplish this do not look trivial. |
@remkop Would it be possible for Picocli to expose a static method to parse the command Class, which is going to be executed without instantiating the command objects?
The text was updated successfully, but these errors were encountered: