mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 15:55:39 +08:00
Add doctor cache check and version management to ensure environment validation
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace StaticPHP\Command;
|
||||
|
||||
use StaticPHP\DI\ApplicationContext;
|
||||
use StaticPHP\Doctor\Doctor;
|
||||
use StaticPHP\Exception\ExceptionHandler;
|
||||
use StaticPHP\Exception\SPCException;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
@@ -118,6 +119,21 @@ abstract class BaseCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Warn the user if doctor has not been run (or is outdated).
|
||||
* Set SPC_SKIP_DOCTOR_CHECK=1 to suppress.
|
||||
*/
|
||||
protected function checkDoctorCache(): void
|
||||
{
|
||||
if (getenv('SPC_SKIP_DOCTOR_CHECK') || Doctor::isHealthy()) {
|
||||
return;
|
||||
}
|
||||
$this->output->writeln('');
|
||||
$this->output->writeln('<comment>[WARNING] Please run `spc doctor` first to verify your build environment.</comment>');
|
||||
$this->output->writeln('');
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
protected function getOption(string $name): mixed
|
||||
{
|
||||
return $this->input->getOption($name);
|
||||
|
||||
Reference in New Issue
Block a user