Comparison

util/startup.lua @ 11829:4fad0ca42f66

util.startup: Allow separate command line argument settings for prosody and prosodyctl Makes it clearer that prosody does not take -v atm, as well as how prosodyctl does not take the demonization flags.
author Kim Alvefur <zash@zash.se>
date Thu, 30 Sep 2021 17:47:00 +0200
parent 11828:024ac556e907
child 11846:6425dfa3de45
comparison
equal deleted inserted replaced
11828:024ac556e907 11829:4fad0ca42f66
20 threshold = 105, speed = 500; 20 threshold = 105, speed = 500;
21 -- Generational mode defaults 21 -- Generational mode defaults
22 minor_threshold = 20, major_threshold = 50; 22 minor_threshold = 20, major_threshold = 50;
23 }; 23 };
24 24
25 local short_params = { D = "daemonize", F = "no-daemonize", v = "verbose" }; 25 local arg_settigs = {
26 local value_params = { config = true }; 26 prosody = {
27 short_params = { D = "daemonize"; F = "no-daemonize" };
28 value_params = { config = true };
29 };
30 prosodyctl = {
31 short_params = { v = "verbose" };
32 value_params = { config = true };
33 };
34 }
27 35
28 function startup.parse_args() 36 function startup.parse_args()
29 local opts, err, where = parse_args(arg, { 37 local opts, err, where = parse_args(arg, arg_settigs[prosody.process_type]);
30 short_params = short_params,
31 value_params = value_params,
32 });
33 if not opts then 38 if not opts then
34 if err == "param-not-found" then 39 if err == "param-not-found" then
35 print("Unknown command-line option: "..tostring(where)); 40 print("Unknown command-line option: "..tostring(where));
36 print("Perhaps you meant to use prosodyctl instead?"); 41 print("Perhaps you meant to use prosodyctl instead?");
37 elseif err == "missing-value" then 42 elseif err == "missing-value" then