Software /
code /
prosody
Diff
util/prosodyctl/shell.lua @ 11520:0a464a6e88c4
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 25 Apr 2021 17:20:58 +0200 |
parent | 11423:0a10bb3b129b |
child | 11521:16caf35f031f |
line wrap: on
line diff
--- 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()