From 4852a270fe55019de1b6e951d80eb9243c00ffa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 14 Feb 2018 08:22:58 -0500 Subject: [PATCH] realtime: implement the `prompt` service MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/readline.nit | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/readline.nit b/lib/readline.nit index 00f920c..6532cb4 100644 --- a/lib/readline.nit +++ b/lib/readline.nit @@ -17,6 +17,8 @@ # GNU readline library wrapper module readline is ldflags "-lreadline" +import prompt + in "C" `{ #include #include @@ -56,3 +58,7 @@ end # Adds the data String to the history no matter what it contains fun add_history(data: String) do native_add_history data.to_cstring + +redef fun prompt(prompt, add_history) do return readline(prompt.to_s, add_history) + +redef fun prompt_add_history(line) do native_add_history(line.to_cstring) -- 1.7.9.5