Fix quit command and move help command
[kaka/cakelight.git] / src / kaka / cakelight / Commands.java
index 38fb77e..a5b612c 100644 (file)
@@ -1,6 +1,10 @@
 package kaka.cakelight;
 
-import kaka.cakelight.mode.*;
+import kaka.cakelight.mode.AmbientMode;
+import kaka.cakelight.mode.SingleColorMode;
+import kaka.cakelight.mode.SunriseMode;
+import kaka.cakelight.mode.TwoColorNoiseMode;
+import kaka.cakelight.mode.VideoMode;
 
 import java.util.function.BiFunction;
 
@@ -21,10 +25,19 @@ class Commands {
        };
     }
 
+    static Console.Command help() {
+       return command(new String[] {"?", "h", "help"}, (console, args) -> {
+           for (Console.Command c : console.getCommands()) {
+               System.out.println(String.join("|", c.getNames()));
+           }
+           return true;
+       });
+    }
+
     static Console.Command quit() {
        return command(new String[] {"q", "quit"}, (console, args) -> {
-           console.getCakelight().turnOff();
-           console.out("stopping cakelight");
+           console.quit();
+           console.out("terminating");
            return true;
        });
     }