diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-09-17 13:59:46 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-09-17 13:59:46 +0200 |
commit | 6e8ccb808ebe538ba8577f4d3170d612e54f59d2 (patch) | |
tree | cf4e2e7a2b8558432affb1219aa0f20f7710671b | |
parent | dcdef72da9a5f9f49f9bbcffb968cb15445e08c8 (diff) | |
download | albotty-6e8ccb808ebe538ba8577f4d3170d612e54f59d2.tar.bz2 albotty-6e8ccb808ebe538ba8577f4d3170d612e54f59d2.tar.xz |
add simple client
-rw-r--r-- | client.lua | 17 |
1 files changed, 17 insertions, 0 deletions
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() + |