Comparison

util/startup.lua @ 12160:ac654fb19203

util.startup: Allow supplying an argument parsing settings The 'prosody' global is not global this early so there was no way to override the process type field or argument parsing settings from outside, e.g. from the migrator.
author Kim Alvefur <zash@zash.se>
date Sun, 09 Jan 2022 15:16:09 +0100
parent 11963:f5c6be4a3ecc
child 12243:73ecfe811526
comparison
equal deleted inserted replaced
12159:aa299551f8c6 12160:ac654fb19203
31 short_params = { v = "verbose", h = "help", ["?"] = "help" }; 31 short_params = { v = "verbose", h = "help", ["?"] = "help" };
32 value_params = { config = true }; 32 value_params = { config = true };
33 }; 33 };
34 } 34 }
35 35
36 function startup.parse_args() 36 function startup.parse_args(profile)
37 local opts, err, where = parse_args(arg, arg_settigs[prosody.process_type]); 37 local opts, err, where = parse_args(arg, arg_settigs[profile or prosody.process_type] or profile);
38 if not opts then 38 if not opts then
39 if err == "param-not-found" then 39 if err == "param-not-found" then
40 print("Unknown command-line option: "..tostring(where)); 40 print("Unknown command-line option: "..tostring(where));
41 if prosody.process_type == "prosody" then 41 if prosody.process_type == "prosody" then
42 print("Perhaps you meant to use prosodyctl instead?"); 42 print("Perhaps you meant to use prosodyctl instead?");