Software / code / prosody
Comparison
util/prosodyctl/shell.lua @ 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 |
| parent | 10877:2b015ef8cd06 |
| child | 10938:a5b8ae066688 |
comparison
equal
deleted
inserted
replaced
| 10936:d770435f0f84 | 10937:d86f59c31458 |
|---|---|
| 60 | 60 |
| 61 local function start(arg) --luacheck: ignore 212/arg | 61 local function start(arg) --luacheck: ignore 212/arg |
| 62 local client = adminstream.client(); | 62 local client = adminstream.client(); |
| 63 local opts = parse_args(arg); | 63 local opts = parse_args(arg); |
| 64 | 64 |
| 65 if not opts then | |
| 66 if err == "param-not-found" then | |
| 67 print("Unknown command-line option: "..tostring(where)); | |
| 68 elseif err == "missing-value" then | |
| 69 print("Expected a value to follow command-line option: "..where); | |
| 70 end | |
| 71 os.exit(1); | |
| 72 end | |
| 73 | |
| 65 client.events.add_handler("connected", function () | 74 client.events.add_handler("connected", function () |
| 66 if not arg.quiet then | 75 if not arg.quiet then |
| 67 printbanner(); | 76 printbanner(); |
| 68 end | 77 end |
| 69 repl(client); | 78 repl(client); |