summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-12-18 16:09:58 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2014-12-18 16:09:58 +0000
commit0f6cac43e5cb211a3fce4c3ecdd91eacc3eddd83 (patch)
treef049b7ed1a6f64dc0e5429436550b48e8f1d0a8a
parentc27b511b28d24ad07cb28cf84e56c475b83603e4 (diff)
elua: getopt updates
-rw-r--r--src/scripts/elua/modules/getopt.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/scripts/elua/modules/getopt.lua b/src/scripts/elua/modules/getopt.lua
index ef16a8bd22..0a73fa2e23 100644
--- a/src/scripts/elua/modules/getopt.lua
+++ b/src/scripts/elua/modules/getopt.lua
@@ -87,8 +87,10 @@ local parse_l = function(opts, opt, descs, args, parser)
87 if desc.list then 87 if desc.list then
88 desc.list[#desc.list + 1] = optret 88 desc.list[#desc.list + 1] = optret
89 opts[optn] = desc.list 89 opts[optn] = desc.list
90 elseif optret ~= nil then
91 opts[optn] = optret
90 else 92 else
91 opts[optn] = optret or true 93 opts[optn] = true
92 end 94 end
93 local dopts = desc.opts 95 local dopts = desc.opts
94 if dopts then 96 if dopts then
@@ -106,6 +108,7 @@ local parse_s = function(opts, optstr, descs, args, parser)
106 local argr = desc[3] 108 local argr = desc[3]
107 if argr or argr == nil then 109 if argr or argr == nil then
108 if optstr == "" then 110 if optstr == "" then
111 optstr = nil
109 if #args == 0 then 112 if #args == 0 then
110 if argr then 113 if argr then
111 error("option -" .. opt .. " requires an argument", 3) 114 error("option -" .. opt .. " requires an argument", 3)
@@ -128,8 +131,10 @@ local parse_s = function(opts, optstr, descs, args, parser)
128 if desc.list then 131 if desc.list then
129 desc.list[#desc.list + 1] = optret 132 desc.list[#desc.list + 1] = optret
130 opts[optn] = desc.list 133 opts[optn] = desc.list
134 elseif optret ~= nil then
135 opts[optn] = optret
131 else 136 else
132 opts[optn] = optret or true 137 opts[optn] = true
133 end 138 end
134 local dopts = desc.opts 139 local dopts = desc.opts
135 if dopts then 140 if dopts then