aboutsummaryrefslogtreecommitdiffstats
path: root/util/prosodyctl/shell.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-04-25 17:20:58 +0200
committerKim Alvefur <zash@zash.se>2021-04-25 17:20:58 +0200
commitea470c72e0517a1128f6152c4fc1233c59a040eb (patch)
tree19dacbc41adb5a98c999726a2163180169332e9a /util/prosodyctl/shell.lua
parent03a1ac4f699af179a1870a1bf6ab33a47aa68351 (diff)
downloadprosody-ea470c72e0517a1128f6152c4fc1233c59a040eb.tar.gz
prosody-ea470c72e0517a1128f6152c4fc1233c59a040eb.zip
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.
Diffstat (limited to 'util/prosodyctl/shell.lua')
-rw-r--r--util/prosodyctl/shell.lua5
1 files changed, 2 insertions, 3 deletions
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()