mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 04:52: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
|
||||
end
|
||||
|
||||
local function isValidCommand(name)
|
||||
local function isValidName(name)
|
||||
return name:match("^[%w]+$") ~= nil
|
||||
end
|
||||
|
||||
@@ -21,8 +21,20 @@ local function scanDirectory(basePath, targetPath)
|
||||
|
||||
if handle then
|
||||
for filePath in handle:lines() do
|
||||
local fileName = filePath:match("([^/]+)%.lua$")
|
||||
if fileName and isValidCommand(fileName) then
|
||||
local parts = {}
|
||||
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("/", ">")
|
||||
table.insert(res, relPath)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user