From e7f9f1976be8eeb8b287c42182c3fb499252fff7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 18 Sep 2017 17:08:31 +0200 Subject: prosodyctl: Only demand a hostname argument to cert commands other than import --- prosodyctl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/prosodyctl b/prosodyctl index 353253ec..74bb2ad8 100755 --- a/prosodyctl +++ b/prosodyctl @@ -939,13 +939,15 @@ function commands.cert(arg) end local subcmd = table.remove(arg, 1); if type(cert_commands[subcmd]) == "function" then - if not arg[1] then - show_message"You need to supply at least one hostname" - arg = { "--help" }; - end - if arg[1] ~= "--help" and not hosts[arg[1]] then - show_message(error_messages["no-such-host"]); - return 1; + if subcmd ~= "import" then -- hostnames are optional for import + if not arg[1] then + show_message"You need to supply at least one hostname" + arg = { "--help" }; + end + if arg[1] ~= "--help" and not hosts[arg[1]] then + show_message(error_messages["no-such-host"]); + return 1; + end end return cert_commands[subcmd](arg); elseif subcmd == "check" then -- cgit v1.2.3