Test
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
local VisualElement = require("elements/VisualElement")
|
||||
local tHex = require("libraries/colorHex")
|
||||
---@configDescription A text input field with various features
|
||||
---@configDefault true
|
||||
|
||||
--- This is the input class. It provides a text input field that can handle user input with various features like
|
||||
--- cursor movement, text manipulation, placeholder text, and input validation.
|
||||
|
||||
@@ -36,24 +36,20 @@ local function parseFile(filePath)
|
||||
requires = {}
|
||||
}
|
||||
|
||||
-- Description aus @configDescription
|
||||
local description = content:match("%-%-%-@configDescription%s*(.-)%s*\n")
|
||||
if description then
|
||||
config.description = description
|
||||
end
|
||||
|
||||
-- Default aus @configDefault
|
||||
local default = content:match("%-%-%-@configDefault%s*(%w+)")
|
||||
if default then
|
||||
config.default = default == "true"
|
||||
end
|
||||
|
||||
-- Dependencies aus @requires
|
||||
for required in content:gmatch("%-%-%-@requires%s*(%w+)") do
|
||||
table.insert(config.requires, required)
|
||||
end
|
||||
|
||||
-- Dependencies aus @class inheritance
|
||||
local className, parent = content:match("%-%-%-@class%s*([^%s:]+)%s*:%s*([^%s\n]+)")
|
||||
if className and parent and parent ~= "PropertySystem" then
|
||||
table.insert(config.requires, parent)
|
||||
@@ -63,7 +59,6 @@ local function parseFile(filePath)
|
||||
end
|
||||
|
||||
local function categorizeFile(path)
|
||||
-- Relativen Pfad verwenden
|
||||
if path:match("/elements/") then
|
||||
return "elements", "UI Elements"
|
||||
elseif path:match("/plugins/") then
|
||||
@@ -78,41 +73,30 @@ end
|
||||
|
||||
local function scanDirectory(srcPath)
|
||||
local files = {}
|
||||
local basePath = srcPath:match("^(.+)/$") or srcPath
|
||||
|
||||
-- Rekursive Funktion zum Scannen von Ordnern
|
||||
local function scanRecursive(dir)
|
||||
local pipe = io.popen('dir "' .. dir .. '" /b')
|
||||
local pipe = io.popen('find "' .. dir .. '" -name "*.lua"')
|
||||
if not pipe then return end
|
||||
|
||||
for entry in pipe:lines() do
|
||||
local fullPath = dir .. "\\" .. entry
|
||||
|
||||
if entry:match("%.lua$") then
|
||||
local config = parseFile(fullPath)
|
||||
if config then
|
||||
config.name = entry:gsub("%.lua$", "")
|
||||
-- Relativen Pfad mit Forward Slashes erstellen
|
||||
config.path = fullPath:gsub("^" .. basePath .. "\\", ""):gsub("\\", "/")
|
||||
files[fullPath] = config
|
||||
end
|
||||
elseif io.popen('dir "' .. fullPath .. '" /ad'):read("*l") then
|
||||
-- Rekursiv in Unterordner gehen
|
||||
scanRecursive(fullPath)
|
||||
|
||||
for path in pipe:lines() do
|
||||
local config = parseFile(path)
|
||||
if config then
|
||||
config.name = path:match("([^/]+)%.lua$")
|
||||
config.path = path:gsub("^" .. srcPath .. "/", "")
|
||||
files[path] = config
|
||||
end
|
||||
end
|
||||
pipe:close()
|
||||
end
|
||||
|
||||
scanRecursive(basePath)
|
||||
scanRecursive(srcPath)
|
||||
return files
|
||||
end
|
||||
|
||||
local function generateConfig(srcPath)
|
||||
local files = scanDirectory(srcPath)
|
||||
local categories = {}
|
||||
|
||||
-- Files in Kategorien einordnen
|
||||
|
||||
for path, fileConfig in pairs(files) do
|
||||
local category, categoryDesc = categorizeFile(path)
|
||||
if not categories[category] then
|
||||
@@ -129,7 +113,6 @@ local function generateConfig(srcPath)
|
||||
}
|
||||
end
|
||||
|
||||
-- Dependencies validieren
|
||||
for catName, cat in pairs(categories) do
|
||||
for fileName, file in pairs(cat.files) do
|
||||
for _, req in ipairs(file.requires or {}) do
|
||||
|
||||
Reference in New Issue
Block a user