From 6e8ccb808ebe538ba8577f4d3170d612e54f59d2 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 17 Sep 2018 13:59:46 +0200 Subject: add simple client --- client.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 client.lua diff --git a/client.lua b/client.lua new file mode 100644 index 0000000..1ea8dc3 --- /dev/null +++ b/client.lua @@ -0,0 +1,17 @@ +local cqueues = require("cqueues") +local socket = require("cqueues.socket") + +function callcmd(conn, cmd) + conn:write(cmd.."\n") + print("response:", conn:read("*l")) +end + +local socketpath = "/tmp/albotty.sock" +local conn = socket.connect{path = socketpath} + +target,msg = ... +for line in string.gmatch(msg, "[^\n]+") do + callcmd(conn, ("/msg %s %s"):format(target, line)) +end +conn:close() + -- cgit v1.2.3