Explorar o código

added printCmds for nice looking help

Denys %!s(int64=5) %!d(string=hai) anos
pai
achega
08ad2434bb
Modificáronse 2 ficheiros con 5 adicións e 5 borrados
  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;
 	    }
     }