123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include <useriomanager.hpp>
- #include <iostream>
- #include <jsoncpp/json/json.h>
- #include <readline/readline.h>
- void UserIoManager::run() {
- std::cout << "UserIoManager::run() says hello!" << std::endl;
-
-
-
- bool keep_reading = true;
- while(keep_reading){
-
- // read an input line
- char *line = readline ("ccats> ");
-
- // if no input, do not add to history, and go to reading next line
- if (strlen(line) == 0) {
- free(line);
- continue;
- }
-
- // add the line to history
- add_history(line);
-
- if(!strcmp(line, "help")) {
-
- std::printf("ccats command line interface\n");
- std::printf("available COMMANDs are:\n");
- std::printf("help - shows this help\n");
- std::printf("status - asks the server for status\n");
- std::printf("close - closes the connection to the server\n");
-
- }
- else if (!strcmp(line, "status")) {
-
- // do stuff
-
- }
- else if (!strcmp(line, "close")) {
-
- // do stuff
-
- keep_reading = false;
-
- }
-
- free(line);
- }
-
- return;
- }
|