mirror of
https://github.com/smogon/sprites.git
synced 2026-03-21 17:35:13 -05:00
remove glob filter/key
This commit is contained in:
parent
e07ce108d7
commit
d9115bbfd2
|
|
@ -46,39 +46,15 @@ end
|
|||
|
||||
function glob(pat, opts)
|
||||
local results = {}
|
||||
local filter = opts and opts.filter
|
||||
local key = opts and opts.key
|
||||
local seen = {}
|
||||
for pat in iter(globpat_normalize(pat)) do
|
||||
for file in iter(tup.glob(pat)) do
|
||||
if key then
|
||||
local k = key(file)
|
||||
if seen[k] then
|
||||
goto continue
|
||||
end
|
||||
seen[k] = true
|
||||
end
|
||||
|
||||
if filter then
|
||||
if not filter(file) then
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(results, file)
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
return results
|
||||
end
|
||||
|
||||
|
||||
|
||||
function glob_matches(pat, opts)
|
||||
local matched = glob(pat, opts)
|
||||
return #matched > 0
|
||||
end
|
||||
|
||||
-- Commands
|
||||
|
||||
local function cspec2cmd(cmdSpec)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user