private CommandLineParser populate(ShellContext shellContext, String line,
final Map<String, InputComponent<?, ?>> allInputs, Map<String, InputComponent<?, ?>> lastPage)
throws Exception
{
WizardCommandController controller = getController();
Map<String, InputComponent<?, ?>> pageInputs = new LinkedHashMap<>(controller.getInputs());
allInputs.putAll(pageInputs);
CommandLineParser parser = commandLineUtil.generateParser(controller, shellContext, allInputs);
CommandLine cmdLine = parser.parse(line, true);
Map<String, InputComponent<?, ?>> populatedInputs = commandLineUtil.populateUIInputs(cmdLine, allInputs);
// Second pass to ensure disabled fields are set
parser = commandLineUtil.generateParser(controller, shellContext, allInputs);
cmdLine = parser.parse(line, true);
populatedInputs = commandLineUtil.populateUIInputs(cmdLine, allInputs);
boolean inputsChanged = false;
for (String input : pageInputs.keySet())
{
// TODO: May not work correctly with Subflows
if (populatedInputs.containsKey(input))
{
// Trim inputs from last page, because information from the current page was provided
lastPage.keySet().removeAll(populatedInputs.keySet());
allInputs.keySet().removeAll(lastPage.keySet());
inputsChanged = true;
break;
}
}
if (controller.canMoveToNextStep())
{
controller.next().initialize();
parser = populate(shellContext, line, allInputs, pageInputs);
}
else if (inputsChanged)
{
parser = commandLineUtil.generateParser(controller, shellContext, allInputs);