elua: ability to specify custom opts table for each desc in getopt

This commit is contained in:
Daniel Kolesa 2014-05-13 15:39:55 +01:00 committed by Daniel Kolesa
parent bc2b6b503f
commit 63ccaee7fd
1 changed files with 10 additions and 0 deletions

View File

@ -58,6 +58,11 @@ local parse_l = function(opts, opt, descs, args, parser)
else
opts[optn] = optret or true
end
local dopts = desc.opts
if dopts then
dopts[#opts + 1] = opts[#opts]
dopts[optn] = opts[optn ]
end
end
local parse_s = function(opts, optstr, descs, args, parser)
@ -92,6 +97,11 @@ local parse_s = function(opts, optstr, descs, args, parser)
else
opts[optn] = optret or true
end
local dopts = desc.opts
if dopts then
dopts[#dopts + 1] = opts[#opts]
dopts[optn] = opts[optn ]
end
end
end