Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 9779:0b04099b49de | 9780:c7727c13260f |
|---|---|
| 81 local jid_split = require "util.jid".prepped_split; | 81 local jid_split = require "util.jid".prepped_split; |
| 82 | 82 |
| 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; | 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; |
| 84 ----------------------- | 84 ----------------------- |
| 85 local commands = {}; | 85 local commands = {}; |
| 86 local command = arg[1]; | 86 local command = table.remove(arg, 1); |
| 87 | 87 |
| 88 function commands.adduser(arg) | 88 function commands.adduser(arg) |
| 89 if not arg[1] or arg[1] == "--help" then | 89 if not arg[1] or arg[1] == "--help" then |
| 90 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); | 90 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); |
| 91 return 1; | 91 return 1; |
| 1363 | 1363 |
| 1364 | 1364 |
| 1365 os.exit(0); | 1365 os.exit(0); |
| 1366 end | 1366 end |
| 1367 | 1367 |
| 1368 os.exit(commands[command]({ select(2, unpack(arg)) })); | 1368 os.exit(commands[command](arg)); |
| 1369 end, watchers); | 1369 end, watchers); |
| 1370 | 1370 |
| 1371 command_runner:run(true); | 1371 command_runner:run(true); |