Software /
code /
prosody
Changeset
10937:d86f59c31458
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 17 Jun 2020 19:36:39 +0200 |
parents | 10936:d770435f0f84 |
children | 10938:a5b8ae066688 |
files | util/prosodyctl/shell.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/shell.lua Wed Jun 17 19:32:12 2020 +0200 +++ b/util/prosodyctl/shell.lua Wed Jun 17 19:36:39 2020 +0200 @@ -62,6 +62,15 @@ 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();