From 63ccaee7fd1cafbfe5b9fd3bd8578f717e0f2f2b Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 13 May 2014 15:39:55 +0100 Subject: [PATCH] elua: ability to specify custom opts table for each desc in getopt --- src/bin/elua/modules/getopt.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bin/elua/modules/getopt.lua b/src/bin/elua/modules/getopt.lua index f145ff9250..f7288e0a5b 100644 --- a/src/bin/elua/modules/getopt.lua +++ b/src/bin/elua/modules/getopt.lua @@ -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