prosodyctl: Pass the original argv table to subcommands (with first argument removed)
This preserves eg arg[-1] where you might find the path to the Lua
executable, which can be useful.
--- a/prosodyctl Thu Jan 10 14:27:01 2019 +0100
+++ b/prosodyctl Thu Jan 10 14:54:34 2019 +0100
@@ -83,7 +83,7 @@
local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
-----------------------
local commands = {};
-local command = arg[1];
+local command = table.remove(arg, 1);
function commands.adduser(arg)
if not arg[1] or arg[1] == "--help" then
@@ -1365,7 +1365,7 @@
os.exit(0);
end
- os.exit(commands[command]({ select(2, unpack(arg)) }));
+ os.exit(commands[command](arg));
end, watchers);
command_runner:run(true);