mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 19:12:19 +00:00
Convert can now be a table used as mapping
This commit is contained in:
@@ -508,7 +508,14 @@ function Parser:_parse(args, errhandler)
|
||||
|
||||
local function convert(element, data)
|
||||
if element._convert then
|
||||
local ok, err = element._convert(data)
|
||||
local ok, err
|
||||
|
||||
if type(element._convert) == "function" then
|
||||
ok, err = element._convert(data)
|
||||
else
|
||||
ok, err = element._convert[data]
|
||||
end
|
||||
|
||||
assert_(ok ~= nil, "%s", err or "malformed argument '" .. data .. "'")
|
||||
data = ok
|
||||
end
|
||||
|
Reference in New Issue
Block a user