diff --git a/src/main/java/org/jboss/aesh/console/command/container/CommandContainer.java b/src/main/java/org/jboss/aesh/console/command/container/CommandContainer.java index 77c32a507..71a97de6a 100644 --- a/src/main/java/org/jboss/aesh/console/command/container/CommandContainer.java +++ b/src/main/java/org/jboss/aesh/console/command/container/CommandContainer.java @@ -19,6 +19,7 @@ */ package org.jboss.aesh.console.command.container; +import org.jboss.aesh.cl.CommandLine; import org.jboss.aesh.cl.parser.CommandLineParserException; import org.jboss.aesh.cl.parser.CommandLineParser; import org.jboss.aesh.cl.validator.CommandValidatorException; @@ -68,4 +69,9 @@ CommandContainerResult executeCommand(AeshLine line, InvocationProviders invocat CommandInvocation commandInvocation) throws CommandLineParserException, OptionValidatorException, CommandValidatorException, CommandException, InterruptedException; + + CommandContainerResult executeCommand(CommandLine commandLine, InvocationProviders invocationProviders, + AeshContext aeshContext, + CommandInvocation commandInvocation) + throws CommandLineParserException, OptionValidatorException, CommandValidatorException, CommandException, InterruptedException; } diff --git a/src/main/java/org/jboss/aesh/console/command/container/DefaultCommandContainer.java b/src/main/java/org/jboss/aesh/console/command/container/DefaultCommandContainer.java index 24950daa3..83b3b304b 100644 --- a/src/main/java/org/jboss/aesh/console/command/container/DefaultCommandContainer.java +++ b/src/main/java/org/jboss/aesh/console/command/container/DefaultCommandContainer.java @@ -45,10 +45,20 @@ public CommandContainerResult executeCommand(AeshLine line, InvocationProviders throws CommandLineParserException, OptionValidatorException, CommandValidatorException, CommandException, InterruptedException { CommandLine commandLine = getParser().parse(line, false); + return executeCommand(commandLine, invocationProviders, aeshContext, commandInvocation); + } + + @Override + public CommandContainerResult executeCommand(CommandLine commandLine, InvocationProviders invocationProviders, + AeshContext aeshContext, + CommandInvocation commandInvocation) + throws CommandLineParserException, OptionValidatorException, CommandValidatorException, CommandException, InterruptedException { + commandLine.getParser().getCommandPopulator().populateObject(commandLine, invocationProviders, aeshContext, true); - if(commandLine.getParser().getProcessedCommand().getValidator() != null && - !commandLine.hasOptionWithOverrideRequired()) + if (commandLine.getParser().getProcessedCommand().getValidator() != null + && !commandLine.hasOptionWithOverrideRequired()) { commandLine.getParser().getProcessedCommand().getValidator().validate(commandLine.getParser().getCommand()); + } CommandResult result = commandLine.getParser().getCommand().execute(commandInvocation);