From ea470c72e0517a1128f6152c4fc1233c59a040eb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 25 Apr 2021 17:20:58 +0200 Subject: util.prosodyctl.shell: Allow calling console commands with fewer shell quotes E.g. `prosodyctl shell module reload disco example.com` becomes equivalent to `prosodyctl shell 'module:reload("disco", "example.com")`. Won't work for every possible command, but reduces the amount of shell quoting problems for most common commands. --- util/prosodyctl/shell.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'util/prosodyctl/shell.lua') diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index a05904f0..f4bc478d 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -73,9 +73,8 @@ local function start(arg) --luacheck: ignore 212/arg if arg[1] then if arg[2] then - -- TODO send each arg[] and wait for reply? - print("Only one command is supported as argument"); - os.exit(1); + -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com") + arg[1] = string.format("%s:%s("..string.rep("%q", #arg-2, ", ")..")", table.unpack(arg)); end client.events.add_handler("connected", function() -- cgit v1.2.3