Skip to content

Commit

Permalink
Clarify options on CreateCommand (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Oct 19, 2023
1 parent 024c175 commit 8b2c1d2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Command/CreateCommand.php
Expand Up @@ -78,10 +78,10 @@ protected function configure(): void
{
$this
->addArgument('name', InputArgument::REQUIRED, 'Table name to generate migration for.')
->addOption('command', 'c', InputOption::VALUE_OPTIONAL, 'Command to execute.', 'create')
->addOption('fields', 'f', InputOption::VALUE_OPTIONAL, 'Table fields to generate.')
->addOption('table-comment', null, InputOption::VALUE_OPTIONAL, 'Table comment.')
->addOption('and', null, InputOption::VALUE_OPTIONAL, 'And junction.')
->addOption('command', 'c', InputOption::VALUE_REQUIRED, 'Command to execute.', 'create')
->addOption('fields', 'f', InputOption::VALUE_REQUIRED, 'Table fields to generate.')
->addOption('table-comment', null, InputOption::VALUE_REQUIRED, 'Table comment.')
->addOption('and', null, InputOption::VALUE_REQUIRED, 'And junction.')
->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path to migration directory.')
->addOption('namespace', 'ns', InputOption::VALUE_REQUIRED, 'Migration file namespace.')
->setHelp('This command generates new migration file.');
Expand Down Expand Up @@ -131,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return Command::INVALID;
}

/** @var string $and */
/** @var string|null $and */
$and = $input->getOption('and');
$name = $this->generateName($command, $table, $and);

Expand Down Expand Up @@ -166,8 +166,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);

if ($helper->ask($input, $output, $question)) {
$fields = $input->hasOption('fields') ? (string) $input->getOption('fields') : null;
$tableComment = $input->hasOption('table-comment') ? (string) $input->getOption('table-comment') : null;
/** @var string|null $fields */
$fields = $input->getOption('fields');
/** @var string|null $tableComment */
$tableComment = $input->getOption('table-comment');

$content = $this->createService->run(
$command,
Expand Down

0 comments on commit 8b2c1d2

Please sign in to comment.