diff options
-rw-r--r-- | src/luarocks/util.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 6dd96e0d..9731f034 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -160,13 +160,12 @@ function util.parse_flags(...) | |||
160 | local flags = {} | 160 | local flags = {} |
161 | local i = 1 | 161 | local i = 1 |
162 | local out = {} | 162 | local out = {} |
163 | local ignore_flags = false | 163 | local state = "initial" |
164 | while i <= #args do | 164 | while i <= #args do |
165 | local flag = args[i]:match("^%-%-(.*)") | 165 | local flag = args[i]:match("^%-%-(.*)") |
166 | if flag == "--" then | 166 | if state == "initial" and flag == "" then |
167 | ignore_flags = true | 167 | state = "ignore_flags" |
168 | end | 168 | elseif state == "initial" and flag then |
169 | if flag and not ignore_flags then | ||
170 | local var,val = flag:match("([a-z_%-]*)=(.*)") | 169 | local var,val = flag:match("([a-z_%-]*)=(.*)") |
171 | if val then | 170 | if val then |
172 | local vartype = supported_flags[var] | 171 | local vartype = supported_flags[var] |
@@ -205,7 +204,7 @@ function util.parse_flags(...) | |||
205 | return { ERROR = "Invalid argument: unknown flag --"..var.."." } | 204 | return { ERROR = "Invalid argument: unknown flag --"..var.."." } |
206 | end | 205 | end |
207 | end | 206 | end |
208 | else | 207 | elseif state == "ignore_flags" or (state == "initial" and not flag) then |
209 | table.insert(out, args[i]) | 208 | table.insert(out, args[i]) |
210 | end | 209 | end |
211 | i = i + 1 | 210 | i = i + 1 |