@@ 32-62 (lines=31) @@ | ||
29 | * |
|
30 | * @author Adam Kadlec <[email protected]> |
|
31 | */ |
|
32 | final class InstallCommand extends Command |
|
33 | { |
|
34 | /** |
|
35 | * @return void |
|
36 | */ |
|
37 | protected function configure() : void |
|
38 | { |
|
39 | $this |
|
40 | ->setName('ipub:packages:install') |
|
41 | ->addArgument('package', Input\InputArgument::REQUIRED, 'Package name') |
|
42 | ->setDescription('Install package.'); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @param Input\InputInterface $input |
|
47 | * @param Output\OutputInterface $output |
|
48 | * |
|
49 | * @return void |
|
50 | */ |
|
51 | protected function execute(Input\InputInterface $input, Output\OutputInterface $output) : void |
|
52 | { |
|
53 | try { |
|
54 | $this->packageManager->install($input->getArgument('package')); |
|
55 | ||
56 | $output->writeln(sprintf('Package \'%s\' has been installed.', $input->getArgument('package'))); |
|
57 | ||
58 | } catch (Exceptions\InvalidArgumentException $e) { |
|
59 | $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); |
|
60 | } |
|
61 | } |
|
62 | } |
|
63 |
@@ 32-62 (lines=31) @@ | ||
29 | * |
|
30 | * @author Adam Kadlec <[email protected]> |
|
31 | */ |
|
32 | final class UninstallCommand extends Command |
|
33 | { |
|
34 | /** |
|
35 | * @return void |
|
36 | */ |
|
37 | protected function configure() : void |
|
38 | { |
|
39 | $this |
|
40 | ->setName('ipub:packages:uninstall') |
|
41 | ->addArgument('package', Input\InputArgument::REQUIRED, 'Package name') |
|
42 | ->setDescription('Uninstall package.'); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @param Input\InputInterface $input |
|
47 | * @param Output\OutputInterface $output |
|
48 | * |
|
49 | * @return void |
|
50 | */ |
|
51 | protected function execute(Input\InputInterface $input, Output\OutputInterface $output) : void |
|
52 | { |
|
53 | try { |
|
54 | $this->packageManager->uninstall($input->getArgument('package')); |
|
55 | ||
56 | $output->writeln(sprintf('Package \'%s\' has been installed.', $input->getArgument('package'))); |
|
57 | ||
58 | } catch (Exceptions\InvalidArgumentException $e) { |
|
59 | $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); |
|
60 | } |
|
61 | } |
|
62 | } |
|
63 |