Skip to content

Commit

Permalink
Adjust argument to option
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn committed Jul 31, 2019
1 parent c893655 commit 582ecfc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Command/GenerateSitemapCommand.php
Expand Up @@ -11,8 +11,8 @@
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

final class GenerateSitemapCommand extends Command
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct(

protected function configure(): void
{
$this->addArgument('channel', InputArgument::IS_ARRAY, 'Channel codes to render. If none supplied, all channels will generated.');
$this->addOption('channel', 'c', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Channel codes to generate. If none supplied, all channels will generated.');
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down Expand Up @@ -107,8 +107,8 @@ private function path(ChannelInterface $channel, string $path): string
*/
private function channels(InputInterface $input): iterable
{
if (!empty($input->getArgument('channel'))) {
return $this->channelRepository->findBy(['code' => $input->getArgument('channel'), 'enabled' => true]);
if (!empty($input->getOption('channel'))) {
return $this->channelRepository->findBy(['code' => $input->getOption('channel'), 'enabled' => true]);
}

return $this->channelRepository->findBy(['enabled' => true]);
Expand Down

0 comments on commit 582ecfc

Please sign in to comment.