From 008cd93a1833e96512d843079e2d96dc6b851a52 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 21 Sep 2021 00:00:49 +0300 Subject: [PATCH] feat(console): use args for EntriesHasCommand #543 --- .../core/Console/Commands/Entries/EntrieHasCommand.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flextype/core/Console/Commands/Entries/EntrieHasCommand.php b/src/flextype/core/Console/Commands/Entries/EntrieHasCommand.php index c4f26a6b..8c45c824 100644 --- a/src/flextype/core/Console/Commands/Entries/EntrieHasCommand.php +++ b/src/flextype/core/Console/Commands/Entries/EntrieHasCommand.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace Flextype\Console\Commands\Entries; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; @@ -21,18 +21,18 @@ class EntriesHasCommand extends Command { $this->setName('entries:has'); $this->setDescription('Check whether entry exists.'); - $this->addOption('id', null, InputOption::VALUE_REQUIRED, 'Unique identifier of the entry.'); + $this->addArgument('id', InputArgument::REQUIRED, 'Unique identifier of the entry.'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - if (entries()->has($input->getOption('id'))) { - $io->success('Entry ' . $input->getOption('id') . ' exists'); + if (entries()->has($input->getArgument('id'))) { + $io->success('Entry ' . $input->getArgument('id') . ' exists'); return Command::SUCCESS; } else { - $io->error('Entry ' . $input->getOption('id') . ' doesn\'t exists'); + $io->error('Entry ' . $input->getArgument('id') . ' doesn\'t exists'); return Command::FAILURE; } }