38 lines
845 B
PHP
38 lines
845 B
PHP
<?php
|
|
|
|
$base = file_get_contents(__DIR__."/src/base.sh");
|
|
|
|
|
|
$dirs = [
|
|
__DIR__.'/src/commands/*.sh',
|
|
__DIR__.'/src/commands/*/*.sh',
|
|
__DIR__.'/src/commands/*/*/*.sh',
|
|
__DIR__.'/src/functions/*.sh'
|
|
];
|
|
|
|
$codes = [];
|
|
|
|
foreach($dirs as $dir){
|
|
foreach(glob($dir) as $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("{{ FUNCTIONS }}", implode("\n", $codes['functions']), $base);
|
|
$code = str_replace("{{ COMMANDS }}", implode("\n", $codes['commands']), $code);
|
|
|
|
try {
|
|
$file = __DIR__.'/wx.tmp';
|
|
$file = fopen($file, "w");
|
|
fwrite($file, $code);
|
|
fclose($file);
|
|
} catch (\Error $e) {
|
|
}
|
|
|
|
?>
|