aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-02-04 19:01:34 +0100
committerKim Alvefur <zash@zash.se>2022-02-04 19:01:34 +0100
commitd57bd7a33c2e828b7e8d94923df3f0dcb258e8e7 (patch)
tree583ff34465dc03867cdd66331beb253e0c4f0863
parentf75d9d7ed80d1ccf65b716733703ad84f7297a81 (diff)
downloadprosody-d57bd7a33c2e828b7e8d94923df3f0dcb258e8e7.tar.gz
prosody-d57bd7a33c2e828b7e8d94923df3f0dcb258e8e7.zip
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.
-rwxr-xr-xprosodyctl22
1 files changed, 11 insertions, 11 deletions
diff --git a/prosodyctl b/prosodyctl
index 61c47bed..e4a0cc00 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -80,7 +80,7 @@ function commands.install(arg)
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 @@ function commands.remove(arg)
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 @@ function commands.list(arg)
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 @@ function commands.adduser(arg)
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 @@ function commands.passwd(arg)
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 @@ function commands.deluser(arg)
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 @@ function commands.start(arg)
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 @@ function commands.status(arg)
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 @@ function commands.stop(arg)
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 @@ function commands.about(arg)
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 @@ function commands.reload(arg)
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");