remove glob filter/key

This commit is contained in:
Christopher Monsanto 2020-05-25 21:38:45 -04:00
parent e07ce108d7
commit d9115bbfd2

View File

@ -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)