@Override
public void process(String[] args, PrintStream output) throws Exception {
if (args.length == 0) {
// TODO: print help message
throw new InvalidCommandException();
}
String commandName = args[0];
Iterable<Command> matches = commandsMap.getValuesForKeysStartingWith(commandName);
if (Iterables.isEmpty(matches)) {
throw new InvalidCommandException();
}
Command command = matches.iterator().next();
command.process(Arrays.copyOfRange(args, 1, args.length), output);
}