使用tp内置的命令行交互操作

This commit is contained in:
2022-09-05 17:50:49 +08:00
parent 9493bfdc9b
commit b9972f9353

View File

@@ -109,9 +109,10 @@ class Curd extends Command
$output->writeln($key);
}
$output->writeln(">>>>>>>>>>>>>>>");
$output->writeln("确定强制生成上方所有文件? 如果文件存在会直接覆盖。 请输入 'yes' 按回车键继续操作: ");
$line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r'));
if (trim($line) != 'yes') {
$ask_force_delete_result = $output->confirm($input,'确定强制生成上方所有文件? 如果文件存在会直接覆盖。');
if (!$ask_force_delete_result) {
throw new Exception("取消文件CURD生成操作");
}
}
@@ -123,9 +124,10 @@ class Curd extends Command
$output->writeln($key);
}
$output->writeln(">>>>>>>>>>>>>>>");
$output->writeln("确定删除上方所有文件? 请输入 'yes' 按回车键继续操作: ");
$line = fgets(defined('STDIN') ? STDIN : fopen('php://stdin', 'r'));
if (trim($line) != 'yes') {
$ask_force_delete_result = $output->confirm($input,'确定删除上方所有文件? ');
if (!$ask_force_delete_result) {
throw new Exception("取消删除文件操作");
}
$result = $build->delete();