From a2539d4dcda7910ed5f725badc5f5be75ffa44a7 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 13 Jan 2024 11:00:20 +0100 Subject: mod_invites: Show short help instead of traceback on missing hostname --- plugins/mod_invites.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_invites.lua b/plugins/mod_invites.lua index 5d378f84..dedd3aa5 100644 --- a/plugins/mod_invites.lua +++ b/plugins/mod_invites.lua @@ -249,9 +249,10 @@ function module.command(arg) end function subcommands.generate(arg) - local function help() + local function help(short) print("usage: prosodyctl mod_" .. module.name .. " generate DOMAIN --reset USERNAME") print("usage: prosodyctl mod_" .. module.name .. " generate DOMAIN [--admin] [--role ROLE] [--group GROUPID]...") + if short then return 2 end print() print("This command has two modes: password reset and new account.") print("If --reset is given, the command operates in password reset mode and in new account mode otherwise.") @@ -284,7 +285,7 @@ function subcommands.generate(arg) local mm = require "prosody.core.modulemanager"; local host = table.remove(arg, 1); -- pop host - assert(prosody.hosts[host], "Host "..tostring(host).." does not exist"); + if not host then return help(true) end sm.initialize_host(host); module.host = host; --luacheck: ignore 122/module token_storage = module:open_store("invite_token", "map"); -- cgit v1.2.3