if (commandTerms.length > 1) {
System.arraycopy(commandTerms, 1, extraTerms, 0, extraTerms.length);
}
final String commandName = commandTerms[0];
Command command = commandMap.get(commandName);
if (command == null && aliasMap != null) {
//treat command name as an alias
String aliasName = commandName;
String aliasCommandName = aliasMap.get(aliasName);
command = commandMap.get(aliasCommandName);
}
if (command != null) {
if (extraTerms.length > 0 && command instanceof TextParsingCommand) {
TextParsingCommand t = (TextParsingCommand) command;
t.extractText(extraTerms, commandState);
}
try {
commandState.captureInput(command);
command.execute(commandState);
}
catch (TerminatedCommandException e) {
//a terminated application exception should be silently caught and ignored
}
catch (TerminatedApplicationException e) {