Merge pull request #341 from crazywhalecc/no-ansi-build

Apply default `--no-ansi` output
This commit is contained in:
Jerry Ma 2024-02-18 13:54:27 +08:00 committed by GitHub
commit 78f4317660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,11 +56,6 @@ abstract class BaseCommand extends Command
// 如果 return false 则错误会继续递交给 PHP 标准错误处理
return true;
}, E_ALL | E_STRICT);
if ($input->getOption('debug')) {
global $ob_logger;
$ob_logger = new ConsoleLogger(LogLevel::DEBUG);
define('DEBUG_MODE', true);
}
$version = ConsoleApplication::VERSION;
if (!$this->no_motd) {
echo " _ _ _ _
@ -83,6 +78,14 @@ abstract class BaseCommand extends Command
$this->input = $input;
$this->output = $output;
global $ob_logger;
if ($input->getOption('debug')) {
$ob_logger = new ConsoleLogger(LogLevel::DEBUG, decorated: !$input->getOption('no-ansi'));
define('DEBUG_MODE', true);
} else {
$ob_logger = new ConsoleLogger(decorated: !$input->getOption('no-ansi'));
}
// windows fallback
Prompt::fallbackWhen(PHP_OS_FAMILY === 'Windows');
ConfirmPrompt::fallbackUsing(function (ConfirmPrompt $prompt) use ($input, $output) {