From 8b6ae2fafe1b4f182f9bc9d34697394919eaea1b Mon Sep 17 00:00:00 2001 From: qnnp <58357109+qnnp-me@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:49:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(MakeModelCommand):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E7=A1=AE=E8=AE=A4=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 --yes/-y 选项用于跳过文件覆盖确认 - 当存在同名文件时,可通过 --yes 选项直接覆盖 - 保留原有交互式确认逻辑作为默认行为 - 当使用自动化脚本执行相关命令时可以跳过确认步骤 --- src/Commands/MakeModelCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Commands/MakeModelCommand.php b/src/Commands/MakeModelCommand.php index 0abb768..c95a93c 100644 --- a/src/Commands/MakeModelCommand.php +++ b/src/Commands/MakeModelCommand.php @@ -24,6 +24,7 @@ protected function configure() $this->addArgument('name', InputArgument::REQUIRED, 'Model name'); $this->addArgument('type', InputArgument::OPTIONAL, 'Type'); $this->addOption('connection', 'c', InputOption::VALUE_OPTIONAL, 'Select database connection. '); + $this->addOption('yes', 'y', InputOption::VALUE_NONE, 'Skip confirmation'); } /** @@ -75,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $type = !$database && $thinkorm ? 'tp' : 'laravel'; } - if (is_file($file)) { + if (is_file($file) && !$input->getOption('yes')) { $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("$file already exists. Do you want to override it? (yes/no)", false); if (!$helper->ask($input, $output, $question)) {