module creator check if file exists -f

This commit is contained in:
Xenomporio 2022-06-25 13:49:22 +02:00
parent 682d680d2a
commit 1e0df65ba7

View File

@ -33,6 +33,12 @@ if ($argc >= 2) {
$verbose = false;
}
if (in_array('-f', $argv)) {
$force = true;
} else {
$force = false;
}
if (!str_starts_with($argv[1],'-')) {
$module_name = $argv[1];
} else {
@ -47,8 +53,9 @@ if ($argc >= 2) {
$target_php_folder = "../../www/pages/";
$target_tpl_folder = "../../www/pages/content/";
if (file_exists($php_file_name)) {
echo("File exists: ." . $php_file_name . "\n");
if (!$force && file_exists($target_php_folder.$php_file_name)) {
echo("File exists: ." .$target_php_folder.$php_file_name . "\n");
echo("Use -f to force overwrite.\n");
exit;
}