Software /
code /
prosody
Changeset
12265:47d5233a1fc7
prosodyctl: Return success status code from --help
Only when the help is shown because of invalid arguments should a
non-zero status code be returned to indicate a problem.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Feb 2022 19:01:34 +0100 |
parents | 12264:ba712f7559dc |
children | 12266:24b0c4c4e28a |
files | prosodyctl |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/prosodyctl Fri Feb 04 18:56:01 2022 +0100 +++ b/prosodyctl Fri Feb 04 19:01:34 2022 +0100 @@ -80,7 +80,7 @@ local opts = parse_args(arg, only_help); if opts.help or not arg[1] then show_usage([[install]], [[Installs a prosody/luarocks plugin]]); - return 1; + return opts.help and 0 or 1; end -- TODO finalize config option name local server = configmanager.get("*", "plugin_server"); @@ -102,7 +102,7 @@ local opts = parse_args(arg, only_help); if opts.help or not arg[1] then show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]); - return 1; + return opts.help and 0 or 1; end show_message("Removing %s from %s", arg[1], prosody.paths.installer); local ret = call_luarocks("remove", arg[1]); @@ -113,7 +113,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[list]], [[Shows installed rocks]]); - return 1; + return 0; end local ret = call_luarocks("list", arg[1]); return ret; @@ -123,7 +123,7 @@ local opts = parse_args(arg, only_help); if opts.help or not arg[1] then show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); - return 1; + return opts.help and 0 or 1; end local user, host = jid_split(arg[1]); if not user and host then @@ -163,7 +163,7 @@ local opts = parse_args(arg, only_help); if opts.help or not arg[1] then show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]); - return 1; + return opts.help and 0 or 1; end local user, host = jid_split(arg[1]); if not user and host then @@ -203,7 +203,7 @@ local opts = parse_args(arg, only_help); if opts.help or not arg[1] then show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]); - return 1; + return opts.help and 0 or 1; end local user, host = jid_split(arg[1]); if not user and host then @@ -262,7 +262,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[start]], [[Start Prosody]]); - return 1; + return 0; end service_command_warning("start"); local ok, ret = prosodyctl.isrunning(); @@ -327,7 +327,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[status]], [[Reports the running status of Prosody]]); - return 1; + return 0; end local ok, ret = prosodyctl.isrunning(); @@ -362,7 +362,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[stop]], [[Stop a running Prosody server]]); - return 1; + return 0; end service_command_warning("stop"); @@ -413,7 +413,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[about]], [[Show information about this Prosody installation]]); - return 1; + return 0; end local pwd = "."; @@ -535,7 +535,7 @@ local opts = parse_args(arg, only_help); if opts.help then show_usage([[reload]], [[Reload Prosody's configuration and re-open log files]]); - return 1; + return 0; end service_command_warning("reload");