Generator Update

This commit is contained in:
Christer Warén 2024-04-27 21:14:13 +03:00
parent ee152b0562
commit 91ae087bd4

View File

@ -7,18 +7,13 @@ $dirs = [
__DIR__.'/src/commands/*.sh',
__DIR__.'/src/commands/*/*.sh',
__DIR__.'/src/commands/*/*/*.sh',
__DIR__.'/src/functions/*.sh',
__DIR__.'/src/elements.sh'
__DIR__.'/src/functions/*.sh'
];
$codes = [];
foreach($dirs as $dir){
foreach(glob($dir) as $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);
}
@ -28,8 +23,7 @@ foreach($dirs as $dir){
}
}
$code = str_replace("{{ ELEMENTS }}", implode("\n", $codes['elements']), $base);
$code = str_replace("{{ FUNCTIONS }}", implode("\n", $codes['functions']), $code);
$code = str_replace("{{ FUNCTIONS }}", implode("\n", $codes['functions']), $base);
$code = str_replace("{{ COMMANDS }}", implode("\n", $codes['commands']), $code);
try {
@ -37,10 +31,7 @@ try {
$file = fopen($file, "w");
fwrite($file, $code);
fclose($file);
echo "Status: Successful";
} catch (\Error $e) {
echo "Status: Failed";
}
?>