use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Uid\Factory\UlidFactory;
#[AsCommand(name: 'ulid:generate', description: 'Generate a ULID')]
class GenerateUlidCommand extends Command
{ private UlidFactory
$factory;
public function __construct(UlidFactory
$factory = null
) { $this->factory =
$factory ??
new UlidFactory();
parent::
__construct();
} protected function configure(): void
{ $this ->
setDefinition([ new InputOption('time', null, InputOption::VALUE_REQUIRED, 'The ULID timestamp: a parsable date/time string'
),
new InputOption('count', 'c', InputOption::VALUE_REQUIRED, 'The number of ULID to generate', 1
),
new InputOption('format', 'f', InputOption::VALUE_REQUIRED,
sprintf('The ULID output format ("%s")',
implode('", "',
$this->
getAvailableFormatOptions())), 'base32'
),
])