add doctor command

This commit is contained in:
crazywhalecc
2023-04-22 21:23:12 +08:00
parent 4c0d35c723
commit 528ad1199a
11 changed files with 334 additions and 27 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace SPC\command;
use SPC\doctor\CheckListHandler;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand('doctor', 'Diagnose whether the current environment can compile normally')]
@@ -11,7 +12,14 @@ class DoctorCommand extends BaseCommand
{
public function handle(): int
{
logger()->error('Not implemented');
return 1;
try {
$checker = new CheckListHandler($this->input, $this->output);
$checker->runCheck(FIX_POLICY_PROMPT);
$this->output->writeln('<info>Doctor check complete !</info>');
} catch (\Throwable $e) {
$this->output->writeln('<error>' . $e->getMessage() . '</error>');
return 1;
}
return 0;
}
}