34 lines
906 B
PHP
34 lines
906 B
PHP
<?php
|
|
namespace ProVM\Command;
|
|
|
|
use Symfony\Component\Console;
|
|
use ProVM\Generator;
|
|
|
|
#[Console\Attribute\AsCommand(
|
|
name: 'generate:seeds'
|
|
)]
|
|
class GenerateSeeds extends Console\Command\Command
|
|
{
|
|
public function __construct(protected Generator\Seed $seedGenerator, ?string $name = null)
|
|
{
|
|
parent::__construct($name);
|
|
}
|
|
|
|
protected function configure(): void
|
|
{
|
|
parent::configure();
|
|
$this->addOption('dry-run', 'd', Console\Input\InputOption::VALUE_OPTIONAL, default: false);
|
|
}
|
|
|
|
public function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output): int
|
|
{
|
|
$io = new Console\Style\SymfonyStyle($input, $output);
|
|
$io->title('Generate Seeds');
|
|
|
|
$dryRun = $input->getOption('dry-run');
|
|
|
|
$this->seedGenerator->generate($io, $dryRun);
|
|
|
|
return Console\Command\Command::SUCCESS;
|
|
}
|
|
} |