Software /
code /
prosody
Changeset
12376:10353ad0ca7a
prosodyctl: check: Slightly improved argument handling
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 05 Mar 2022 11:36:38 +0000 |
parents | 12375:ea5e46601cfb |
children | 12377:317132bca8c0 |
files | util/prosodyctl/check.lua |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/prosodyctl/check.lua Sat Mar 05 11:31:22 2022 +0000 +++ b/util/prosodyctl/check.lua Sat Mar 05 11:36:38 2022 +0000 @@ -254,6 +254,9 @@ short_params = { h = "help", v = "verbose"; }; + value_params = { + ping = true; + }; }; local function check(arg) @@ -262,7 +265,14 @@ return 1; end local what = table.remove(arg, 1); - local opts = assert(parse_args(arg, check_opts)); + local opts, opts_err, opts_info = parse_args(arg, check_opts); + if opts_err == "missing-value" then + print("Error: Expected a value after '"..opts_info.."'"); + return 1; + elseif opts_err == "param-not-found" then + print("Error: Unknown parameter: "..opts_info); + return 1; + end local array = require "util.array"; local set = require "util.set"; local it = require "util.iterators";