diff options
author | Kim Alvefur <zash@zash.se> | 2020-06-17 19:36:39 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-06-17 19:36:39 +0200 |
commit | 5dc0e3901776eb546f69536bd0ca80a8715a84df (patch) | |
tree | bc59da62bc7f931070995e87613963e40c67c878 | |
parent | d8ec3f98bef461a1e04a1c208aef4e18d537f9f9 (diff) | |
download | prosody-5dc0e3901776eb546f69536bd0ca80a8715a84df.tar.gz prosody-5dc0e3901776eb546f69536bd0ca80a8715a84df.zip |
util.prosodyctl.shell: Handle argument parsing errors
While almost identical to the handling in util.startup, this seems more
appropriate. It would also simplify if shell-specific options need to be
handled in the future.
-rw-r--r-- | util/prosodyctl/shell.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index 3e98540f..d0a6881e 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -62,6 +62,15 @@ local function start(arg) --luacheck: ignore 212/arg local client = adminstream.client(); local opts = parse_args(arg); + if not opts then + if err == "param-not-found" then + print("Unknown command-line option: "..tostring(where)); + elseif err == "missing-value" then + print("Expected a value to follow command-line option: "..where); + end + os.exit(1); + end + client.events.add_handler("connected", function () if not arg.quiet then printbanner(); |