From 586cbdfd2dc65be2da3be0ec459da013c9e7b86b Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 20 Sep 2021 23:54:01 +0300 Subject: [PATCH] feat(console): use args for EntriesDeleteCommand #543 --- .../Console/Commands/Entries/EntriesDeleteCommand.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flextype/core/Console/Commands/Entries/EntriesDeleteCommand.php b/src/flextype/core/Console/Commands/Entries/EntriesDeleteCommand.php index 166bc1bb..cc937d87 100644 --- a/src/flextype/core/Console/Commands/Entries/EntriesDeleteCommand.php +++ b/src/flextype/core/Console/Commands/Entries/EntriesDeleteCommand.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 EntriesDeleteCommand extends Command { $this->setName('entries:delete'); $this->setDescription('Delete entry.'); - $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()->delete($input->getOption('id'))) { - $io->success('Entry ' . $input->getOption('id') . ' deleted.'); + if (entries()->delete($input->getArgument('id'))) { + $io->success('Entry ' . $input->getArgument('id') . ' deleted.'); return Command::SUCCESS; } else { - $io->error('Entry ' . $input->getOption('id') . ' wasn\'t deleted.'); + $io->error('Entry ' . $input->getArgument('id') . ' wasn\'t deleted.'); return Command::FAILURE; } }