util.startup: Show brief usage on `prosody -h|-?|--help`
authorKim Alvefur <zash@zash.se>
Mon, 25 Oct 2021 15:46:01 +0200
changeset 11873 d52a73425eba
parent 11872 ae093c259da2
child 11874 1d1ed2be3491
util.startup: Show brief usage on `prosody -h|-?|--help` Seems more suitable than asking if prosodyctl was meant to be used, or going ahead and starting.
util/startup.lua
--- a/util/startup.lua	Sun Oct 24 15:17:01 2021 +0200
+++ b/util/startup.lua	Mon Oct 25 15:46:01 2021 +0200
@@ -24,7 +24,7 @@
 
 local arg_settigs = {
 	prosody = {
-		short_params = { D = "daemonize"; F = "no-daemonize" };
+		short_params = { D = "daemonize"; F = "no-daemonize", h = "help", ["?"] = "help" };
 		value_params = { config = true };
 	};
 	prosodyctl = {
@@ -46,6 +46,13 @@
 		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);
+	end
 	prosody.opts = opts;
 end