elua: more informative getopt
authorDaniel Kolesa <quaker66@gmail.com>
Wed, 7 May 2014 09:22:50 +0000 (10:22 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Tue, 10 Jun 2014 14:48:50 +0000 (15:48 +0100)
src/bin/elua/modules/getopt.lua
src/bin/elua/xgettext.lua

index 01327a1..393a13e 100644 (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
index 1dca2e2..ecba552 100644 (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