aboutsummaryrefslogtreecommitdiffstats
path: root/tools/migration/prosody-migrator.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-02-15 23:05:03 +0100
committerKim Alvefur <zash@zash.se>2017-02-15 23:05:03 +0100
commit20ff11cfc9b824ae15e5315248c6ce368c0d0d3f (patch)
tree67fd147c7eafbef789d8a5f9ab9d1fb0dd81bee6 /tools/migration/prosody-migrator.lua
parent885e117a1fe2f0a77d330c89ad5e44636f25815e (diff)
parent7d79421b6e703c62382534db614a8da2a3e91ff3 (diff)
downloadprosody-20ff11cfc9b824ae15e5315248c6ce368c0d0d3f.tar.gz
prosody-20ff11cfc9b824ae15e5315248c6ce368c0d0d3f.zip
Merge 0.10->trunk
Diffstat (limited to 'tools/migration/prosody-migrator.lua')
-rw-r--r--tools/migration/prosody-migrator.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua
index 8560ddb5..6cff9f67 100644
--- a/tools/migration/prosody-migrator.lua
+++ b/tools/migration/prosody-migrator.lua
@@ -5,30 +5,29 @@ 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";
-- 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;
@@ -48,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);