From 5af6db124a35868be947a91bfeb8206bd18ded6c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 5 Mar 2022 11:36:38 +0000 Subject: prosodyctl: check: Slightly improved argument handling --- util/prosodyctl/check.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua index b452a0bf..c0eeffcc 100644 --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -254,6 +254,9 @@ local check_opts = { short_params = { h = "help", v = "verbose"; }; + value_params = { + ping = true; + }; }; local function check(arg) @@ -262,7 +265,14 @@ local function check(arg) 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"; -- cgit v1.2.3