aboutsummaryrefslogtreecommitdiffstats
path: root/tools/migration
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-02-15 15:30:19 +0100
committerKim Alvefur <zash@zash.se>2017-02-15 15:30:19 +0100
commit00b6eff872e3e5d3b47c4fb28ebf51ca3e0083cc (patch)
tree3da75b56444ab08113d17cbb27c97557de1a19a4 /tools/migration
parentff264550994b47cb1c6139477246c3f41340c822 (diff)
downloadprosody-00b6eff872e3e5d3b47c4fb28ebf51ca3e0083cc.tar.gz
prosody-00b6eff872e3e5d3b47c4fb28ebf51ca3e0083cc.zip
migrator: Fix argument parsing
Diffstat (limited to 'tools/migration')
-rw-r--r--tools/migration/prosody-migrator.lua9
1 files changed, 4 insertions, 5 deletions
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;