Selaa lähdekoodia

added printCmds for nice looking help

Denys 5 vuotta sitten
vanhempi
commit
08ad2434bb
2 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  1. 4 1
      cli/src/commands.cpp
  2. 1 4
      cli/src/useriomanager.cpp

+ 4 - 1
cli/src/commands.cpp

@@ -1,4 +1,5 @@
 #include "../include/commands.hpp"
+#include <cstdio>
 
 CMD commands[]{
     {CMD_HELP, "help", "show help"},
@@ -43,5 +44,7 @@ const char *getCmdStringFromId(COMMANDID id) {
 }
 
 void printCmds(void) {
-  // TODO
+  for(CMD command : commands) {
+    printf("%-12s - %s\n", command.name, command.desc);
+  }
 }

+ 1 - 4
cli/src/useriomanager.cpp

@@ -316,10 +316,7 @@ void UserIoManager::run() {
 	    case CMD_HELP: {
 	      std::printf("\n");
 	      std::printf("AVAILABLE COMMANDS are:\n");
-	      printCmds(); // TODO: implement to have put and get in here
-	      std::printf("help        - shows this help\n");
-	      std::printf("status      - asks the server for status\n");
-	      std::printf("disconnect  - closes the connection to the server\n");
+	      printCmds();
 	      break;
 	    }
     }