elua: more informative getopt

This commit is contained in:
Daniel Kolesa 2014-05-07 10:22:50 +01:00 committed by Daniel Kolesa
parent 55b7973e56
commit 344c1cbaf1
2 changed files with 5 additions and 3 deletions

View File

@ -49,7 +49,8 @@ local parse_l = function(opts, opt, descs, args, parser)
if desc.callback then rets = { desc:callback(parser, optval) } end
if not rets or #rets == 0 then rets = { optval } end
local optn = desc.alias or desc[1] or desc[2]
opts[#opts + 1] = { optn, unpack(rets) }
opts[#opts + 1] = { optn, short = desc[1], long = desc[2],
alias = desc.alias, unpack(rets) }
local optret = #rets > 1 and rets or rets[1]
if desc.list then
desc.list[#desc.list + 1] = optret
@ -83,7 +84,8 @@ local parse_s = function(opts, optstr, descs, args, parser)
if desc.callback then rets = { desc:callback(parser, optval) } end
if not rets or #rets == 0 then rets = { optval } end
local optn = desc.alias or desc[1] or desc[2]
opts[#opts + 1] = { optn, unpack(rets) }
opts[#opts + 1] = { optn, short = desc[1], long = desc[2],
alias = desc.alias, unpack(rets) }
local optret = #rets > 1 and rets or rets[1]
if desc.list then
desc.list[#desc.list + 1] = optret

View File

@ -165,7 +165,7 @@ end
local hasxgettext = os.getenv("XGETTEXT")
if hasxgettext then
local gargs = { hasxgettext }
local gargs = { hasxgettext, "--join-existing" }
for i = 1, #opts do
gargs[#gargs + 1] = arg[i]
end