diff options
author | Kim Alvefur <zash@zash.se> | 2017-02-15 15:30:19 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-02-15 15:30:19 +0100 |
commit | 374f61a26b937601159ac2422a90ff9ae36139bc (patch) | |
tree | 3da75b56444ab08113d17cbb27c97557de1a19a4 /tools/migration/prosody-migrator.lua | |
parent | 03eeb56d06aa44827c7881c2c1e6acc46312abdc (diff) | |
download | prosody-374f61a26b937601159ac2422a90ff9ae36139bc.tar.gz prosody-374f61a26b937601159ac2422a90ff9ae36139bc.zip |
migrator: Fix argument parsing
Diffstat (limited to 'tools/migration/prosody-migrator.lua')
-rw-r--r-- | tools/migration/prosody-migrator.lua | 9 |
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; |