diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-29 15:02:57 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-29 15:02:57 +0100 |
commit | 953f18fe681a2f120dab5be9e9884bf35765e21e (patch) | |
tree | d0cc4812c2f8c95a773e938bf7c3576af40cd98d /frontend/cli.cpp | |
parent | 3562802cacc8dbd0c155146acfdb8d04c6440009 (diff) |
more WIP (command handling moved to player)
Diffstat (limited to 'frontend/cli.cpp')
-rw-r--r-- | frontend/cli.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/frontend/cli.cpp b/frontend/cli.cpp deleted file mode 100644 index de78bc1..0000000 --- a/frontend/cli.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <cstdlib> -#include <cstdio> - -#include <readline/readline.h> -#include <readline/history.h> - -#include "cli.h" -#include "frontend/print.h" -#include "strings.h" -#include "cmd.h" - -using namespace std; - -string cli_readline() { - const char * PROMPT = "> "; - - char * input = readline(PROMPT); - SessionLog::get().append(PROMPT); - if (input == NULL) exit(EXIT_SUCCESS); // ctrl-d - string out = string(input); - if (out.size() > 0) add_history(input); - free(input); - - SessionLog::get().append(out); - SessionLog::get().append("\n"); - - return out; -} - -void cli_main() { - while (1) { - string line = cli_readline(); - if (line.length() == 0) continue; - vector<string> argv = split_string(line, " "); - cmd_handle(argv); - } -} - |