Changeset

12423:3ae9299d61d7 0.12

util.startup: Show error for unrecognized arguments passed to 'prosody' (fixes #1722)
author Matthew Wild <mwild1@gmail.com>
date Mon, 21 Mar 2022 10:06:48 +0000
parents 12420:b78b8689173a
children 12424:929bfe92bb56 12427:018ac691ee22
files util/startup.lua
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/util/startup.lua	Sat Mar 19 11:41:05 2022 +0000
+++ b/util/startup.lua	Mon Mar 21 10:06:48 2022 +0000
@@ -46,12 +46,19 @@
 		end
 		os.exit(1);
 	end
-	if opts.help and prosody.process_type == "prosody" then
-		print("prosody [ -D | -F ] [ --config /path/to/prosody.cfg.lua ]");
-		print("  -D, --daemonize       Run in the background")
-		print("  -F, --no-daemonize    Run in the foreground")
-		print("  --config FILE         Specify config file")
-		os.exit(0);
+	if prosody.process_type == "prosody" then
+		if #arg > 0 then
+			print("Unrecognized option: "..arg[1]);
+			print("(Did you mean 'prosodyctl "..arg[1].."'?)");
+			print("");
+		end
+		if opts.help or #arg > 0 then
+			print("prosody [ -D | -F ] [ --config /path/to/prosody.cfg.lua ]");
+			print("  -D, --daemonize       Run in the background")
+			print("  -F, --no-daemonize    Run in the foreground")
+			print("  --config FILE         Specify config file")
+			os.exit(0);
+		end
 	end
 	prosody.opts = opts;
 end