Diff

prosodyctl @ 9780:c7727c13260f

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.
author Kim Alvefur <zash@zash.se>
date Thu, 10 Jan 2019 14:54:34 +0100
parent 9709:f31ed70c993a
child 9782:d844e197eedf
line wrap: on
line diff
--- 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);