Display the help when no argument is given on the command line.
@@ -154,11 +154,15 @@ public class CommandManager implements Command {
*/
public CommandState execute(CommandState state, String[] args) throws Exception {
// Maybe print general help or version info
- String commandName = args[0];
- if ("help".equals(commandName) && (args.length == 1)) {
+
+ if ((args.length == 0) || "help".equals(args[0]) && (args.length == 1)) {
printHelp();
return state;
- } else if ("help".equals(commandName)) {
+ }
+
+ String commandName = args[0];
+
+ if ("help".equals(commandName)) {
commandName = args[1];
Command cmd = commands.get(commandName);
CommandLineHelper.printHelp(cmd.getUsage(), cmd.getOptions());
