Some commands are manipulating Command as values e.g.: echo-dmr ls -l
The Command echo-dmr would need an API to:
- retrieve a populated command. Today this can (nearly) be done the following way:
CommandContainer<Command> container = registry.getCommand(opName, originalInput);
CommandLine line = container.getParser().parse(originalInput, false);
line.getParser().getCommandPopulator().populateObject(line, commandInvocation.getInvocationProviders(), commandInvocation.getAeshContext(), true);
Command c = line.getParser().getCommand();
You will notice that commandInvocation.getInvocationProviders() is not today exposed by the AeshConsole,
2 possible API:
- Simply expose the InvocationProviders in the AeshConsole.
- Or expose a new method Command getPopulatedCommand(String commandLine) in the CommandInvocation interface.
I would vote for the method that hides the detail of how the parsing is operated.