more tests, fixed some incorrect behaviour

This commit is contained in:
mpeterv
2013-12-31 22:15:11 +04:00
parent 74029edae0
commit ebd1c7b268
3 changed files with 113 additions and 2 deletions

View File

@@ -250,7 +250,7 @@ function Parser:parse(args)
element = self:assert(state.context[name], "unknown option " .. name)
state:handle_option(name)
if i ~= #data and not (element:can_take(0) and data:sub(i+1, i+1):match "[a-zA-Z]") then
if i ~= #data and not (element.minargs == 0 and data:sub(i+1, i+1):match "[a-zA-Z]") then
state:handle_argument(data:sub(i+1))
break
end

View File

@@ -65,7 +65,7 @@ function State:get_result()
result[element.target] = invocations[1][1]
end
else
result[element.target] = invocations[1] or {}
result[element.target] = invocations[1]
end
else
if element.maxargs == 0 then