feat(console): 添加 --force-force 参数以跳过所有交互确认

This commit is contained in:
augushong
2026-01-31 23:00:51 +08:00
parent 0fad2b7e10
commit 5bee1b3733
7 changed files with 181 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace base\common\console;
use think\console\Input;
class InputBase extends Input
{
public function __construct($argv = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
array_shift($argv);
}
$argv = $this->normalizeTokens($argv);
parent::__construct($argv);
}
protected function normalizeTokens(array $tokens): array
{
$result = [];
foreach ($tokens as $token) {
if ($token === '-ff') {
$result[] = '--force-force';
continue;
}
$result[] = $token;
}
return $result;
}
}