| @@ 14-43 (lines=30) @@ | ||
| 11 | * Class RemoveCommand |
|
| 12 | * @package Geekish\Crap\Command |
|
| 13 | */ |
|
| 14 | final class RemoveCommand extends BaseComposerCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritDoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | $this->setName('remove'); |
|
| 22 | $this->setDescription('Gets package name and version by alias, calls `composer remove`'); |
|
| 23 | $this->addArgument('aliases', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package aliases'); |
|
| 24 | ||
| 25 | $command = new ComposerRemoveCommand; |
|
| 26 | ||
| 27 | foreach ($command->getDefinition()->getOptions() as $option) { |
|
| 28 | $this->getDefinition()->addOption($option); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @inheritDoc |
|
| 34 | * @codeCoverageIgnore |
|
| 35 | */ |
|
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $packages = $this->helper->parseArguments($input->getArgument('aliases'), true); |
|
| 39 | ||
| 40 | $options = $this->getOptions($input, $output->isDecorated()); |
|
| 41 | $helper = $this->getHelper('process'); |
|
| 42 | $process = $this->createProcess('remove', $packages, $options); |
|
| 43 | ||
| 44 | $helper->run($output, $process, 'Command failed.', function ($type, $data) use ($output) { |
|
| 45 | $output->write($data, false); |
|
| 46 | }); |
|
| @@ 14-49 (lines=36) @@ | ||
| 11 | * Class RequireCommand |
|
| 12 | * @package Geekish\Crap\Command |
|
| 13 | */ |
|
| 14 | final class RequireCommand extends BaseComposerCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritDoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | $this->setName('require'); |
|
| 22 | $this->setDescription('Gets package name and version by alias, calls `composer require`'); |
|
| 23 | $this->addArgument('aliases', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package aliases'); |
|
| 24 | ||
| 25 | $command = new ComposerRequireCommand; |
|
| 26 | ||
| 27 | foreach ($command->getDefinition()->getOptions() as $option) { |
|
| 28 | $this->getDefinition()->addOption($option); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @inheritDoc |
|
| 34 | * @codeCoverageIgnore |
|
| 35 | */ |
|
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $packages = $this->helper->parseArguments($input->getArgument('aliases')); |
|
| 39 | ||
| 40 | $options = $this->getOptions($input, $output->isDecorated()); |
|
| 41 | $helper = $this->getHelper('process'); |
|
| 42 | $process = $this->createProcess('require', $packages, $options); |
|
| 43 | ||
| 44 | $helper->run($output, $process, 'Command failed.', function ($type, $data) use ($output) { |
|
| 45 | $output->write($data, false); |
|
| 46 | }); |
|
| 47 | ||
| 48 | return $process->getExitCode(); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 14-49 (lines=36) @@ | ||
| 11 | * Class UpdateCommand |
|
| 12 | * @package Geekish\Crap\Command |
|
| 13 | */ |
|
| 14 | final class UpdateCommand extends BaseComposerCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritDoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | $this->setName('update'); |
|
| 22 | $this->setDescription('Gets package name and version by alias, calls `composer update`'); |
|
| 23 | $this->addArgument('aliases', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package aliases'); |
|
| 24 | ||
| 25 | $command = new ComposerUpdateCommand; |
|
| 26 | ||
| 27 | foreach ($command->getDefinition()->getOptions() as $option) { |
|
| 28 | $this->getDefinition()->addOption($option); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @inheritDoc |
|
| 34 | * @codeCoverageIgnore |
|
| 35 | */ |
|
| 36 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 37 | { |
|
| 38 | $packages = $this->helper->parseArguments($input->getArgument('aliases')); |
|
| 39 | ||
| 40 | $options = $this->getOptions($input, $output->isDecorated()); |
|
| 41 | $helper = $this->getHelper('process'); |
|
| 42 | $process = $this->createProcess('update', $packages, $options); |
|
| 43 | ||
| 44 | $helper->run($output, $process, 'Command failed.', function ($type, $data) use ($output) { |
|
| 45 | $output->write($data, false); |
|
| 46 | }); |
|
| 47 | ||
| 48 | return $process->getExitCode(); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||