2024-04-26 01:32:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$base = file_get_contents(__DIR__."/src/base.sh");
|
|
|
|
|
|
|
|
|
|
|
|
$dirs = [
|
|
|
|
__DIR__.'/src/commands/*.sh',
|
|
|
|
__DIR__.'/src/commands/*/*.sh',
|
2024-04-27 17:08:52 +00:00
|
|
|
__DIR__.'/src/commands/*/*/*.sh',
|
|
|
|
__DIR__.'/src/functions/*.sh',
|
|
|
|
__DIR__.'/src/elements.sh'
|
2024-04-26 01:32:06 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
$codes = [];
|
|
|
|
|
|
|
|
foreach($dirs as $dir){
|
|
|
|
foreach(glob($dir) as $file){
|
2024-04-27 17:08:52 +00:00
|
|
|
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);
|
|
|
|
}
|
2024-04-26 01:32:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 17:08:52 +00:00
|
|
|
$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);
|
2024-04-26 01:32:06 +00:00
|
|
|
|
|
|
|
try {
|
2024-04-26 02:49:32 +00:00
|
|
|
$file = __DIR__.'/wx.tmp';
|
2024-04-26 01:32:06 +00:00
|
|
|
$file = fopen($file, "w");
|
|
|
|
fwrite($file, $code);
|
|
|
|
fclose($file);
|
|
|
|
|
|
|
|
echo "Status: Successful";
|
|
|
|
} catch (\Error $e) {
|
|
|
|
echo "Status: Failed";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|