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
commitf21bbbab6037681ce1496c47213661ad6465a775 (patch)
tree67fd147c7eafbef789d8a5f9ab9d1fb0dd81bee6 /tools/migration/prosody-migrator.lua
parentbd92525bf197b524edd4716f5c0a2773d54c5aa7 (diff)
parent7a2ed1a9edb96cc8c53cbc1428968b70cfe64f2c (diff)
downloadprosody-f21bbbab6037681ce1496c47213661ad6465a775.tar.gz
prosody-f21bbbab6037681ce1496c47213661ad6465a775.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);