From 1576445984fe494388d8f51d365b00aab5296027 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Fri, 21 Feb 2025 19:26:09 +0100 Subject: [PATCH] Test --- src/elements/Input.lua | 2 ++ tools/generate-config.lua | 37 ++++++++++--------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/elements/Input.lua b/src/elements/Input.lua index 76310c6..62462ac 100644 --- a/src/elements/Input.lua +++ b/src/elements/Input.lua @@ -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. diff --git a/tools/generate-config.lua b/tools/generate-config.lua index 316c758..1ad6c53 100644 --- a/tools/generate-config.lua +++ b/tools/generate-config.lua @@ -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