mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 23:42:48 +08:00
36 lines
892 B
PHP
36 lines
892 B
PHP
<?php
|
|
|
|
namespace base\common\console;
|
|
|
|
use think\console\Input;
|
|
use think\console\Output;
|
|
|
|
class OutputBase extends Output
|
|
{
|
|
public function confirm(Input $input, $question, $default = true)
|
|
{
|
|
$question = $this->appendForceForceTip($question);
|
|
|
|
if ($this->isForceForceEnabled($input)) {
|
|
return $default;
|
|
}
|
|
|
|
return parent::confirm($input, $question, $default);
|
|
}
|
|
|
|
protected function isForceForceEnabled(Input $input): bool
|
|
{
|
|
return (bool) $input->getOption('force-force');
|
|
}
|
|
|
|
protected function appendForceForceTip($question): string
|
|
{
|
|
$tip = '<comment>(您可以追加 --force-force 或 -ff 参数重新运行以跳过所有交互确认)</comment>';
|
|
if (is_string($question) && $question !== '') {
|
|
return rtrim($question) . ' ' . $tip;
|
|
}
|
|
|
|
return $tip;
|
|
}
|
|
}
|