Mercurial > prosody-hg
comparison util/startup.lua @ 11869:d52a73425eba
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.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 25 Oct 2021 15:46:01 +0200 |
| parents | 515a89dee6ae |
| children | 1d1ed2be3491 |
comparison
equal
deleted
inserted
replaced
| 11868:ae093c259da2 | 11869:d52a73425eba |
|---|---|
| 22 minor_threshold = 20, major_threshold = 50; | 22 minor_threshold = 20, major_threshold = 50; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 local arg_settigs = { | 25 local arg_settigs = { |
| 26 prosody = { | 26 prosody = { |
| 27 short_params = { D = "daemonize"; F = "no-daemonize" }; | 27 short_params = { D = "daemonize"; F = "no-daemonize", h = "help", ["?"] = "help" }; |
| 28 value_params = { config = true }; | 28 value_params = { config = true }; |
| 29 }; | 29 }; |
| 30 prosodyctl = { | 30 prosodyctl = { |
| 31 short_params = { v = "verbose" }; | 31 short_params = { v = "verbose" }; |
| 32 value_params = { config = true }; | 32 value_params = { config = true }; |
| 43 end | 43 end |
| 44 elseif err == "missing-value" then | 44 elseif err == "missing-value" then |
| 45 print("Expected a value to follow command-line option: "..where); | 45 print("Expected a value to follow command-line option: "..where); |
| 46 end | 46 end |
| 47 os.exit(1); | 47 os.exit(1); |
| 48 end | |
| 49 if opts.help and prosody.process_type == "prosody" then | |
| 50 print("prosody [ -D | -F ] [ --config /path/to/prosody.cfg.lua ]"); | |
| 51 print(" -D, --daemonize Run in the background") | |
| 52 print(" -F, --no-daemonize Run in the foreground") | |
| 53 print(" --config FILE Specify config file") | |
| 54 os.exit(0); | |
| 48 end | 55 end |
| 49 prosody.opts = opts; | 56 prosody.opts = opts; |
| 50 end | 57 end |
| 51 | 58 |
| 52 function startup.read_config() | 59 function startup.read_config() |
