} else {
String commandName = args[0];
if (commandName.equals("-h") || commandName.equals("--help")) {
printHelp();
} else {
Command command =
CommandFactory.getInstance().getCommand(commandName);
if (command == null) {
printUsage();
} else {
String[] commandArgs =
Arrays.copyOfRange(args, 1, args.length);
command.run(commandArgs);
}
}
}
} catch (Exception e) {
log.fatal("Unknown exception.", e);