package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.Application;

public class HelpCommand implements Command {
    private CommandMap commands;

    public HelpCommand(Application app) {
        this.commands = app.getCommandMap();
    }

    @Override
    public String getDescription() {
        return "Lists every command";
    }

    @Override
    public String getName() {
        return "help";
    }

    @Override
    public void run(String[] args) {
        System.out.println("TMC commands:");
        for (Command command : this.commands.getCommands().values()) {
            System.out.println("  " + command.getName() + "\t" + command.getDescription());
        }
    }
}

@@ -124,16 +124,45 @@
 mmand %7B%0A
+    private Application app;%0A
     priv
@@ -186,16 +186,16 @@
 mmands;%0A
-
 %0A    pub
@@ -225,24 +225,48 @@
 tion app) %7B%0A
+        this.app = app;%0A
         this
@@ -522,24 +522,132 @@
 g%5B%5D args) %7B%0A
+        System.out.println(%22Usage: tmc-cli %5Bargs%5D COMMAND %5Bcommand-args%5D%22);%0A        System.out.println(%22%22);%0A
         Syst
@@ -842,16 +842,16 @@
 ion());%0A
-
         
@@ -852,16 +852,73 @@
       %7D%0A
+        System.out.println(%22%22);%0A        app.printHelp();%0A
     %7D%0A%7D%0A

Print the cmd arguments to help message.