From 953f18fe681a2f120dab5be9e9884bf35765e21e Mon Sep 17 00:00:00 2001 From: Loek Le Blansch <loek@pipeframe.xyz> Date: Tue, 29 Oct 2024 15:02:57 +0100 Subject: more WIP (command handling moved to player) --- frontend/cli.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 frontend/cli.cpp (limited to 'frontend/cli.cpp') 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); - } -} - -- cgit v1.2.3