[latex3-commits] [git/LaTeX3-latex3-l3build] experimental: Fixed parsing function, added missing option. (c9c34e1)

Paulo Roberto Massa Cereda cereda.paulo at gmail.com
Wed Jul 31 00:16:15 CEST 2019


Repository : https://github.com/latex3/l3build
On branch  : experimental
Link       : https://github.com/latex3/l3build/commit/c9c34e188dc0cc7d4cc68ed66869ac80d9e0fcf9

>---------------------------------------------------------------

commit c9c34e188dc0cc7d4cc68ed66869ac80d9e0fcf9
Author: Paulo Roberto Massa Cereda <cereda.paulo at gmail.com>
Date:   Tue Jul 30 19:16:15 2019 -0300

    Fixed parsing function, added missing option.
    
    - Fixed a wrong remainder insertion.
    - Added 'version' to the option table.


>---------------------------------------------------------------

c9c34e188dc0cc7d4cc68ed66869ac80d9e0fcf9
 l3build-arguments.lua | 57 ++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 41 insertions(+), 16 deletions(-)

diff --git a/l3build-arguments.lua b/l3build-arguments.lua
index 7eeb714..bbfe9b4 100644
--- a/l3build-arguments.lua
+++ b/l3build-arguments.lua
@@ -404,31 +404,51 @@ function l3args.argparse(targets, options, arguments)
                 -- check if the current key reference
                 -- accepts a corresponding value
                 if x['long'] == key then
-                  if not (x['argument'] and not keys[key] ) then
+
+                  if not x['argument'] then
                     key = 'remainder'
+                  else
+
+                    if keys[key] then
+                      key = 'remainder'
+
+                      if not l3args.exists(issues['unknown'], '-' .. key) then
+                        l3args.insert(issues['unknown'], '-' .. key)
+                      end
+
+                      if x['handler'] then
+                        l3args.insert(issues['remainder'], x['handler'](v))
+                      else
+                        l3args.insert(issues['remainder'], v)
+                      end
+                    end
                   end
-                  c = x['handler']
+
                   break
                 end
-              end
 
-              -- set value accordingly
-              if key ~= 'remainder' then
-                if c then
-                  keys[key] = c(v)
-                else
-                  keys[key] = v
+                if key == 'remainder' then
+                  l3args.insert(keys['remainder'], v)
                 end
-              else
-                l3args.insert(keys[key], v)
               end
 
-            -- there is no key, so we are
-            -- in the remainder branch
+--              -- set value accordingly
+--              if key ~= 'remainder' then
+--                if c then
+--                  keys[key] = c(v)
+--                else
+--                  keys[key] = v
+--                end
+--              else
+--                l3args.insert(keys[key], v)
+--              end
+
+--            -- there is no key, so we are
+--            -- in the remainder branch
             else
 
               -- insert the value into the table
-              l3args.insert(keys[key], v)
+              l3args.insert(keys['remainder'], v)
             end
           end
         end
@@ -484,8 +504,8 @@ end
 function l3args.getOptions()
   return {
     {
-      short       = "c",
       long        = "config",
+      short       = "c",
       description = "Sets the config(s) used for running tests",
       handler     = l3args.split,
       argument    = true
@@ -516,8 +536,8 @@ function l3args.getOptions()
       argument    = true
     },
     {
-      short       = "e",
       long        = "engine",
+      short       = "e",
       description = "Sets the engine(s) to use for running test",
       handler     = l3args.split,
       argument    = true
@@ -596,6 +616,11 @@ function l3args.getOptions()
       long        = "texmfhome",
       description = "Location of user texmf tree",
       argument    = true
+    },
+    {
+      long        = "version",
+      short       = "v",
+      argument    = false
     }
   }
 end





More information about the latex3-commits mailing list