[latex3-commits] [latex3/l3sys-query] kb-review: support ls --help (6b488e4)

github at latex-project.org github at latex-project.org
Mon Mar 18 00:31:18 CET 2024


Repository : https://github.com/latex3/l3sys-query
On branch  : kb-review
Link       : https://github.com/latex3/l3sys-query/commit/6b488e48a2f2c43c3940ddee82a202dd93cb3056

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

commit 6b488e48a2f2c43c3940ddee82a202dd93cb3056
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Mar 17 23:31:18 2024 +0000

    support ls --help


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

6b488e48a2f2c43c3940ddee82a202dd93cb3056
 l3sys-query.lua | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/l3sys-query.lua b/l3sys-query.lua
index 0d860ae..93f6170 100755
--- a/l3sys-query.lua
+++ b/l3sys-query.lua
@@ -235,6 +235,8 @@ local function parse_args()
     -- No options are allowed in position 1, so filter those out
     if a == "--version" or a == "-v" then
       cmd = "version"
+    elseif a == "--help" or a == "-h" then
+      cmd = "help"
     elseif not match(a,"^%-") then
       cmd = a
     end
@@ -523,11 +525,13 @@ end
 --
 -- Execute the given command
 --
-
+if cmd == "help" then
+help()
+exit(0)
+elseif cmd == "version" then
+version()
+exit(0)
 -- Only 'known' commands do anything at all
-if cmd == "version" then
-  version()
-  exit(0)
 elseif not cmd_impl[cmd] then
   if cmd == "" then
     info_and_quit(script_name .. ": No " .. script_name .. " command specified.")
@@ -541,7 +545,13 @@ end
 -- Check options are valid for cmd
 for k,_ in pairs(options) do
   local cmds = option_list[k].cmds
-  if not cmds then
+  if k == "help" then
+    help()
+    exit(0)
+  elseif k == "version" then
+    version()
+    exit(0)
+  elseif not cmds then
     -- Should not be possible:
     -- everything except --help and --version should have an entry
     print("Internal error")





More information about the latex3-commits mailing list.