From ff264550994b47cb1c6139477246c3f41340c822 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 15 Feb 2017 15:29:37 +0100 Subject: migrator: Unexpand whitespace --- tools/migration/prosody-migrator.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/migration') diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua index 8560ddb5..85234745 100644 --- a/tools/migration/prosody-migrator.lua +++ b/tools/migration/prosody-migrator.lua @@ -5,11 +5,11 @@ CFG_CONFIGDIR=os.getenv("PROSODY_CFGDIR"); -- Substitute ~ with path to home directory in paths if CFG_CONFIGDIR then - CFG_CONFIGDIR = CFG_CONFIGDIR:gsub("^~", os.getenv("HOME")); + CFG_CONFIGDIR = CFG_CONFIGDIR:gsub("^~", os.getenv("HOME")); end if CFG_SOURCEDIR then - CFG_SOURCEDIR = CFG_SOURCEDIR:gsub("^~", os.getenv("HOME")); + CFG_SOURCEDIR = CFG_SOURCEDIR:gsub("^~", os.getenv("HOME")); end local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua"; -- cgit v1.2.3 From 00b6eff872e3e5d3b47c4fb28ebf51ca3e0083cc Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 15 Feb 2017 15:30:19 +0100 Subject: migrator: Fix argument parsing --- tools/migration/prosody-migrator.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tools/migration') diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua index 85234745..7ceff721 100644 --- a/tools/migration/prosody-migrator.lua +++ b/tools/migration/prosody-migrator.lua @@ -16,19 +16,18 @@ local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua"; -- Command-line parsing local options = {}; -local handled_opts = 0; -for i = 1, #arg do +local i = 1; +while arg[i] do if arg[i]:sub(1,2) == "--" then local opt, val = arg[i]:match("([%w-]+)=?(.*)"); if opt then options[(opt:sub(3):gsub("%-", "_"))] = #val > 0 and val or true; end - handled_opts = i; + table.remove(arg, i); else - break; + i = i + 1; end end -table.remove(arg, handled_opts); if CFG_SOURCEDIR then package.path = CFG_SOURCEDIR.."/?.lua;"..package.path; -- cgit v1.2.3 From fc7dadb6a71c4294edfd8e0844f929f757927a5e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 15 Feb 2017 15:30:34 +0100 Subject: migrator: Fix missing word --- tools/migration/prosody-migrator.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/migration') diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua index 7ceff721..6cff9f67 100644 --- a/tools/migration/prosody-migrator.lua +++ b/tools/migration/prosody-migrator.lua @@ -47,7 +47,7 @@ config = {}; local config_env = setmetatable({}, { __index = function(t, k) return function(tbl) config[k] = tbl; end; end }); local config_chunk, err = envloadfile(config_file, config_env); if not config_chunk then - print("There was an error loading the config file, check the file exists"); + print("There was an error loading the config file, check that the file exists"); print("and that the syntax is correct:"); print("", err); os.exit(1); -- cgit v1.2.3