[latex3-commits] [latex3/l3sys-query] main: Issue 'short' help for unknown or badly-speced opts (85b1220)

github at latex-project.org github at latex-project.org
Thu Mar 7 09:06:29 CET 2024


Repository : https://github.com/latex3/l3sys-query
On branch  : main
Link       : https://github.com/latex3/l3sys-query/commit/85b1220e32aebb6ebc8b99f97eb6db62ceba3689

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

commit 85b1220e32aebb6ebc8b99f97eb6db62ceba3689
Author: Joseph Wright <joseph at texdev.net>
Date:   Thu Mar 7 08:06:29 2024 +0000

    Issue 'short' help for unknown or badly-speced opts


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

85b1220e32aebb6ebc8b99f97eb6db62ceba3689
 l3sys-query.lua | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/l3sys-query.lua b/l3sys-query.lua
index 336c020..bb78e83 100755
--- a/l3sys-query.lua
+++ b/l3sys-query.lua
@@ -279,6 +279,12 @@ local function parse_args()
         end
       end
 
+      -- A short auxiliary
+      local function moreinfo()
+        stderr:write("Try '" .. script_name .. " --help' for more information.")
+        exit(1)
+      end
+
       -- Now check that the option is valid and sort out the argument
       -- if required
       local optname = opts[opt]
@@ -288,24 +294,21 @@ local function parse_args()
           if optarg then
             local opt = "-" .. (match(a,"^%-%-") and "-" or "") .. opt
             stderr:write("Value not allowed for option " .. opt .. "\n")
-            cmd = "help"
-            return
+            moreinfo()
           end
         else
           if not optarg then
             optarg = arg[i + 1]
             if not optarg then
               stderr:write("Missing value for option " .. a .. "\n")
-              cmd = "help"
-              return
+              moreinfo()
             end
             i = i + 1
           end
         end
       else
         stderr:write("Unknown option " .. a .. "\n")
-        cmd = "help"
-        return
+        moreinfo()
       end
 
       -- Store the result





More information about the latex3-commits mailing list.