[latex3-commits] [latex3/l3sys-query] main: Use "arg_list" no "spec" in code (e5e7584)
github at latex-project.org
github at latex-project.org
Thu Mar 7 14:11:53 CET 2024
Repository : https://github.com/latex3/l3sys-query
On branch : main
Link : https://github.com/latex3/l3sys-query/commit/e5e7584147e9d3401bea32bd160be2a47db350bd
>---------------------------------------------------------------
commit e5e7584147e9d3401bea32bd160be2a47db350bd
Author: Joseph Wright <joseph at texdev.net>
Date: Thu Mar 7 13:11:53 2024 +0000
Use "arg_list" no "spec" in code
We cannot use "args" and just "arg" is likely too similar.
>---------------------------------------------------------------
e5e7584147e9d3401bea32bd160be2a47db350bd
l3sys-query.lua | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/l3sys-query.lua b/l3sys-query.lua
index 0430886..25c0082 100755
--- a/l3sys-query.lua
+++ b/l3sys-query.lua
@@ -212,7 +212,7 @@ end
-- Initial data for the command line parser
local cmd = ""
local options = {}
-local spec = ""
+local arg_list = ""
local function parse_args()
-- Turn long/short options into two lookup tables
@@ -264,7 +264,7 @@ local function parse_args()
local a = arg[i]
-- Terminate search for options
if a == "--" then
- spec = tidy(i + 1)
+ arg_list = tidy(i + 1)
return
end
@@ -337,7 +337,7 @@ local function parse_args()
-- Collect up the remaining arguments
if not opt then
- spec = tidy(i)
+ arg_list = tidy(i)
break
end
end
@@ -413,9 +413,9 @@ end
-- The aim here is to convert a user file specification (if given) into a
-- Lua pattern, and then to do a listing.
cmd_desc.ls = "Prints a listing based on the <args> and <options>"
-function cmd_impl.ls(spec)
- if not spec or spec == "" then
- spec = "*"
+function cmd_impl.ls(arg_list)
+ if not arg_list or arg_list == "" then
+ arg_list = "*"
end
-- On Windows, "texlua" will expand globs itself: this can be suppressed by
-- surrounding with "'". Formally, this only needs one "'" at one end, but
@@ -423,22 +423,22 @@ function cmd_impl.ls(spec)
-- surrounding "'". That means that "l3sys-query" can always be called with
-- a glob argument surrounded by "'...'" and will work independent of
-- platform.
- if match(spec,"^'") and match(spec,"'$") then
- spec = sub(spec,2,-2)
+ if match(arg_list,"^'") and match(arg_list,"'$") then
+ arg_list = sub(arg_list,2,-2)
end
-- Look for absolute paths or any trying to leave the confines of the current
-- directory: this is not supported.
- if match(spec,"%.%.") or
- match(spec,"^/") or
- match(spec,"^\\") or
- match(spec,"[a-zA-Z]:") then
+ if match(arg_list,"%.%.") or
+ match(arg_list,"^/") or
+ match(arg_list,"^\\") or
+ match(arg_list,"[a-zA-Z]:") then
return
end
-- Tidy up and convert to a pattern.
- path,glob = match(spec,"^(.*)/([^/]*)$")
+ path,glob = match(arg_list,"^(.*)/([^/]*)$")
if not path then
path = "."
- glob = spec
+ glob = arg_list
end
if path == "" then
path = "."
@@ -573,7 +573,7 @@ for k,_ in pairs(options) do
end
end
-local result = cmd_impl[cmd](spec)
+local result = cmd_impl[cmd](arg_list)
if result then
print(result)
More information about the latex3-commits
mailing list.