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.
--- a/util/prosodyctl/shell.lua Thu Apr 15 15:57:24 2021 +0200
+++ b/util/prosodyctl/shell.lua Sun Apr 25 17:20:58 2021 +0200
@@ -73,9 +73,8 @@
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()