migrator: Reuse earlier usage text
authorKim Alvefur <zash@zash.se>
Sun, 09 Jan 2022 15:57:59 +0100
changeset 12166 b7ee14ba09c9
parent 12165 6e7678f6fe9a
child 12167 59b65cc6312f
migrator: Reuse earlier usage text
tools/migration/prosody-migrator.lua
--- a/tools/migration/prosody-migrator.lua	Sun Jan 09 15:19:55 2022 +0100
+++ b/tools/migration/prosody-migrator.lua	Sun Jan 09 15:57:59 2022 +0100
@@ -34,6 +34,11 @@
 
 local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua";
 
+local function usage()
+	print("Usage: " .. arg[0] .. " FROM_STORE TO_STORE");
+	print("If no stores are specified, 'input' and 'output' are used.");
+end
+
 local startup = require "util.startup";
 do
 	startup.parse_args({
@@ -43,7 +48,7 @@
 	startup.init_global_state();
 	prosody.process_type = "migrator";
 	if prosody.opts.help then
-		print("prosody-migrator [input] [output]")
+		usage();
 		os.exit(0);
 	end
 	startup.force_console_logging();
@@ -112,8 +117,7 @@
 
 if have_err then
 	print("");
-	print("Usage: "..arg[0].." FROM_STORE TO_STORE");
-	print("If no stores are specified, 'input' and 'output' are used.");
+	usage();
 	print("");
 	print("The available stores in your migrator config are:");
 	print("");