Software /
code /
prosody
Comparison
tools/migration/prosody-migrator.lua @ 12161:6e7678f6fe9a
migrator: Customise cli argument parsing (--help, --verbose)
Previously -v etc would do nothing and --config without argument would
not have worked correctly.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Jan 2022 15:19:55 +0100 |
parent | 11731:076ceb405b94 |
child | 12162:b7ee14ba09c9 |
comparison
equal
deleted
inserted
replaced
12160:ac654fb19203 | 12161:6e7678f6fe9a |
---|---|
34 | 34 |
35 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua"; | 35 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua"; |
36 | 36 |
37 local startup = require "util.startup"; | 37 local startup = require "util.startup"; |
38 do | 38 do |
39 startup.parse_args(); | 39 startup.parse_args({ |
40 short_params = { v = "verbose", h = "help", ["?"] = "help" }; | |
41 value_params = { config = true }; | |
42 }); | |
40 startup.init_global_state(); | 43 startup.init_global_state(); |
41 prosody.process_type = "migrator"; | 44 prosody.process_type = "migrator"; |
45 if prosody.opts.help then | |
46 print("prosody-migrator [input] [output]") | |
47 os.exit(0); | |
48 end | |
42 startup.force_console_logging(); | 49 startup.force_console_logging(); |
43 startup.init_logging(); | 50 startup.init_logging(); |
44 startup.init_gc(); | 51 startup.init_gc(); |
45 startup.init_errors(); | 52 startup.init_errors(); |
46 startup.setup_plugindir(); | 53 startup.setup_plugindir(); |