diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-24 09:02:05 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-24 09:02:05 +0200 |
commit | 4135a6d2fc4f71d1ef753c5353d8f99b6327bb12 (patch) | |
tree | 9b2ffc36c1ed10be5badcc9a39f737c3feae09bb /src | |
parent | a9d126eb3a34c47f051351e3617833ed29fd1f6d (diff) |
Ditching readline for libedit, resulting in a much more flexible approach to line input.
Diffstat (limited to 'src')
-rw-r--r-- | src/Dalos-cli.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/Dalos-cli.cc b/src/Dalos-cli.cc index fedec88..89069bf 100644 --- a/src/Dalos-cli.cc +++ b/src/Dalos-cli.cc @@ -1,10 +1,10 @@ #include <getopt.h> -#include <readline/readline.h> -#include <readline/history.h> #include <Main.h> #include <TaskMan.h> #include <LuaTask.h> #include <Input.h> +#include <BStdIO.h> +#include "BReadline.h" using namespace Balau; @@ -92,24 +92,17 @@ void MainTask::Do() { if (!interactive) return; - char prompt[3] = "> ", * line_read = NULL; + String line_read; + Readline rl("Dalos-cli", new StdIN()); for (;;) { - if (line_read) - free(line_read); + line_read = rl.gets(); - line_read = readline(prompt); - - if (!line_read) { + if (rl.gotEOF()) { Printer::print("\n"); break; } - if (!*line_read) - continue; - - add_history(line_read); - LuaExecString luaExecString(line_read); luaExecString.exec(luaMainTask); } |