From fb3c902d9aac5f118c36d5a1d0ccf7e0aad677df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 27 Apr 2024 20:08:52 +0300 Subject: [PATCH] Generator Update --- generator.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/generator.php b/generator.php index 8ef7d3e..d4f8212 100644 --- a/generator.php +++ b/generator.php @@ -6,18 +6,31 @@ $base = file_get_contents(__DIR__."/src/base.sh"); $dirs = [ __DIR__.'/src/commands/*.sh', __DIR__.'/src/commands/*/*.sh', - __DIR__.'/src/commands/*/*/*.sh' + __DIR__.'/src/commands/*/*/*.sh', + __DIR__.'/src/functions/*.sh', + __DIR__.'/src/elements.sh' ]; $codes = []; foreach($dirs as $dir){ foreach(glob($dir) as $file){ - $codes[$file] = file_get_contents($file); + if(str_contains($dir, "elements")){ + echo $dir; + $codes['elements'][$file] = file_get_contents($file); + } + if(str_contains($dir, "functions")){ + $codes['functions'][$file] = file_get_contents($file); + } + if(str_contains($dir, "commands")){ + $codes['commands'][$file] = file_get_contents($file); + } } } -$code = str_replace("{{ COMMANDS }}", implode("\n", $codes), $base); +$code = str_replace("{{ ELEMENTS }}", implode("\n", $codes['elements']), $base); +$code = str_replace("{{ FUNCTIONS }}", implode("\n", $codes['functions']), $code); +$code = str_replace("{{ COMMANDS }}", implode("\n", $codes['commands']), $code); try { $file = __DIR__.'/wx.tmp';