mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 19:32:26 +00:00
update List.lua
This commit is contained in:
18
com/List.lua
18
com/List.lua
@@ -10,7 +10,7 @@ if In.Params and In.Params.about then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local function isValidCommand(name)
|
local function isValidName(name)
|
||||||
return name:match("^[%w]+$") ~= nil
|
return name:match("^[%w]+$") ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,8 +21,20 @@ local function scanDirectory(basePath, targetPath)
|
|||||||
|
|
||||||
if handle then
|
if handle then
|
||||||
for filePath in handle:lines() do
|
for filePath in handle:lines() do
|
||||||
local fileName = filePath:match("([^/]+)%.lua$")
|
local parts = {}
|
||||||
if fileName and isValidCommand(fileName) then
|
for part in filePath:gsub(".lua$", ""):gmatch("[^/]+") do
|
||||||
|
table.insert(parts, part)
|
||||||
|
end
|
||||||
|
|
||||||
|
local allValid = true
|
||||||
|
for _, part in ipairs(parts) do
|
||||||
|
if not isValidName(part) then
|
||||||
|
allValid = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if allValid then
|
||||||
local relPath = filePath:gsub("^"..basePath.."/", ""):gsub(".lua$", ""):gsub("/", ">")
|
local relPath = filePath:gsub("^"..basePath.."/", ""):gsub(".lua$", ""):gsub("/", ">")
|
||||||
table.insert(res, relPath)
|
table.insert(res, relPath)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user