Initial Commit
This commit is contained in:
33
generator.php
Normal file
33
generator.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
$base = file_get_contents(__DIR__."/src/base.sh");
|
||||
|
||||
|
||||
$dirs = [
|
||||
__DIR__.'/src/commands/*.sh',
|
||||
__DIR__.'/src/commands/*/*.sh',
|
||||
__DIR__.'/src/commands/*/*/*.sh'
|
||||
];
|
||||
|
||||
$codes = [];
|
||||
|
||||
foreach($dirs as $dir){
|
||||
foreach(glob($dir) as $file){
|
||||
$codes[$file] = file_get_contents($file);
|
||||
}
|
||||
}
|
||||
|
||||
$code = str_replace("{{ COMMANDS }}", implode("\n", $codes), $base);
|
||||
|
||||
try {
|
||||
$file = __DIR__.'/wx';
|
||||
$file = fopen($file, "w");
|
||||
fwrite($file, $code);
|
||||
fclose($file);
|
||||
|
||||
echo "Status: Successful";
|
||||
} catch (\Error $e) {
|
||||
echo "Status: Failed";
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user