From cc8ef4cc24937ace6329ca8ad9ab22fbff1920d7 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 21 Sep 2021 00:00:59 +0300 Subject: [PATCH] feat(console): use args for EntriesMoveCommand #543 --- .../Console/Commands/Entries/EntrieMoveCommand.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/flextype/core/Console/Commands/Entries/EntrieMoveCommand.php b/src/flextype/core/Console/Commands/Entries/EntrieMoveCommand.php index b11db75c..08c84297 100644 --- a/src/flextype/core/Console/Commands/Entries/EntrieMoveCommand.php +++ b/src/flextype/core/Console/Commands/Entries/EntrieMoveCommand.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,19 +21,19 @@ class EntriesMoveCommand extends Command { $this->setName('entries:move'); $this->setDescription('Move entry.'); - $this->addOption('id', null, InputOption::VALUE_REQUIRED, 'Unique identifier of the entry.'); - $this->addOption('newID', null, InputOption::VALUE_REQUIRED, 'New Unique identifier of the entry'); + $this->addArgument('id', InputArgument::REQUIRED, 'Unique identifier of the entry.'); + $this->addArgument('newID', InputArgument::REQUIRED, 'New Unique identifier of the entry'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - if (entries()->move($input->getOption('id'), $input->getOption('newID'))) { - $io->success('Entry ' . $input->getOption('id') . ' moved to ' . $input->getOption('newID')); + if (entries()->move($input->getArgument('id'), $input->getArgument('newID'))) { + $io->success('Entry ' . $input->getArgument('id') . ' moved to ' . $input->getArgument('newID')); return Command::SUCCESS; } else { - $io->error('Entry ' . $input->getOption('id') . ' wasn\'t moved to ' . $input->getOption('newID')); + $io->error('Entry ' . $input->getArgument('id') . ' wasn\'t moved to ' . $input->getArgument('newID')); return Command::FAILURE; } }