diff options
author | Kim Alvefur <zash@zash.se> | 2024-01-13 11:00:20 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-01-13 11:00:20 +0100 |
commit | a2539d4dcda7910ed5f725badc5f5be75ffa44a7 (patch) | |
tree | 6ff5e99bb6af5e31ff8ed0a401691b7641885201 /plugins | |
parent | 2a5e7ab8be5a519be49e79e2edb584ca998864de (diff) | |
download | prosody-a2539d4dcda7910ed5f725badc5f5be75ffa44a7.tar.gz prosody-a2539d4dcda7910ed5f725badc5f5be75ffa44a7.zip |
mod_invites: Show short help instead of traceback on missing hostname
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_invites.lua | 5 |
1 files changed, 3 insertions, 2 deletions
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"); |