about summary refs log tree commit diff stats
path: root/lua/chupacabra/repl.lua
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2024-06-09 15:41:19 -0400
committerelioat <hi@eli.li>2024-06-09 15:41:19 -0400
commit79fcbb5f40e91fc74d4d7b1491b8e246ec6a42b5 (patch)
tree08499113a679e782f997dbaaf78a78a68bed6ca6 /lua/chupacabra/repl.lua
parenta461b64cd0996f707914abc7927bb46da8026e46 (diff)
downloadtour-79fcbb5f40e91fc74d4d7b1491b8e246ec6a42b5.tar.gz
*
Diffstat (limited to 'lua/chupacabra/repl.lua')
-rw-r--r--lua/chupacabra/repl.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/chupacabra/repl.lua b/lua/chupacabra/repl.lua
new file mode 100644
index 0000000..302f306
--- /dev/null
+++ b/lua/chupacabra/repl.lua
@@ -0,0 +1,21 @@
+local chupacabra = require("chupacabra") 
+
+-- simple repl to interact with chupacabra
+
+while true do
+    io.write("chupacabra> ")
+    local input = io.read()
+    if input == "exit" then
+        break
+    end
+    local output = chupacabra.run(input, {})
+    if type(output) == "table" then
+        local outputString = ""
+        for _, value in ipairs(output) do
+            outputString = outputString .. " " .. value -- FIXME: this is dog water
+        end
+        print("["..outputString.."]")
+    else
+        print(output)
+    end
+end