# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1547128474 -3600
# Node ID c7727c13260f6024d5629bf01ca97a6c894fe697
# Parent  0b04099b49dee806056dea6b44ab257961547f1b
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.

diff -r 0b04099b49de -r c7727c13260f prosodyctl
--- 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);