@@ -18,70 +18,70 @@ |
||
| 18 | 18 | use Symfony\Component\Console\Output\OutputInterface; |
| 19 | 19 | |
| 20 | 20 | class Install extends Command { |
| 21 | - public function __construct( |
|
| 22 | - protected IAppManager $appManager, |
|
| 23 | - private Installer $installer, |
|
| 24 | - ) { |
|
| 25 | - parent::__construct(); |
|
| 26 | - } |
|
| 21 | + public function __construct( |
|
| 22 | + protected IAppManager $appManager, |
|
| 23 | + private Installer $installer, |
|
| 24 | + ) { |
|
| 25 | + parent::__construct(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - protected function configure(): void { |
|
| 29 | - $this |
|
| 30 | - ->setName('app:install') |
|
| 31 | - ->setDescription('install an app') |
|
| 32 | - ->addArgument( |
|
| 33 | - 'app-id', |
|
| 34 | - InputArgument::REQUIRED, |
|
| 35 | - 'install the specified app' |
|
| 36 | - ) |
|
| 37 | - ->addOption( |
|
| 38 | - 'keep-disabled', |
|
| 39 | - null, |
|
| 40 | - InputOption::VALUE_NONE, |
|
| 41 | - 'don\'t enable the app afterwards' |
|
| 42 | - ) |
|
| 43 | - ->addOption( |
|
| 44 | - 'force', |
|
| 45 | - 'f', |
|
| 46 | - InputOption::VALUE_NONE, |
|
| 47 | - 'install the app regardless of the Nextcloud version requirement' |
|
| 48 | - ) |
|
| 49 | - ->addOption( |
|
| 50 | - 'allow-unstable', |
|
| 51 | - null, |
|
| 52 | - InputOption::VALUE_NONE, |
|
| 53 | - 'allow installing an unstable releases' |
|
| 54 | - ) |
|
| 55 | - ; |
|
| 56 | - } |
|
| 28 | + protected function configure(): void { |
|
| 29 | + $this |
|
| 30 | + ->setName('app:install') |
|
| 31 | + ->setDescription('install an app') |
|
| 32 | + ->addArgument( |
|
| 33 | + 'app-id', |
|
| 34 | + InputArgument::REQUIRED, |
|
| 35 | + 'install the specified app' |
|
| 36 | + ) |
|
| 37 | + ->addOption( |
|
| 38 | + 'keep-disabled', |
|
| 39 | + null, |
|
| 40 | + InputOption::VALUE_NONE, |
|
| 41 | + 'don\'t enable the app afterwards' |
|
| 42 | + ) |
|
| 43 | + ->addOption( |
|
| 44 | + 'force', |
|
| 45 | + 'f', |
|
| 46 | + InputOption::VALUE_NONE, |
|
| 47 | + 'install the app regardless of the Nextcloud version requirement' |
|
| 48 | + ) |
|
| 49 | + ->addOption( |
|
| 50 | + 'allow-unstable', |
|
| 51 | + null, |
|
| 52 | + InputOption::VALUE_NONE, |
|
| 53 | + 'allow installing an unstable releases' |
|
| 54 | + ) |
|
| 55 | + ; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 59 | - $appId = $input->getArgument('app-id'); |
|
| 60 | - $forceEnable = (bool)$input->getOption('force'); |
|
| 58 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
| 59 | + $appId = $input->getArgument('app-id'); |
|
| 60 | + $forceEnable = (bool)$input->getOption('force'); |
|
| 61 | 61 | |
| 62 | - try { |
|
| 63 | - $this->appManager->getAppPath($appId); |
|
| 64 | - $output->writeln($appId . ' already installed'); |
|
| 65 | - return 1; |
|
| 66 | - } catch (AppPathNotFoundException) { |
|
| 67 | - } |
|
| 62 | + try { |
|
| 63 | + $this->appManager->getAppPath($appId); |
|
| 64 | + $output->writeln($appId . ' already installed'); |
|
| 65 | + return 1; |
|
| 66 | + } catch (AppPathNotFoundException) { |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - try { |
|
| 70 | - $this->installer->downloadApp($appId, $input->getOption('allow-unstable')); |
|
| 71 | - $result = $this->installer->installApp($appId, $forceEnable); |
|
| 72 | - } catch (\Exception $e) { |
|
| 73 | - $output->writeln('Error: ' . $e->getMessage()); |
|
| 74 | - return 1; |
|
| 75 | - } |
|
| 69 | + try { |
|
| 70 | + $this->installer->downloadApp($appId, $input->getOption('allow-unstable')); |
|
| 71 | + $result = $this->installer->installApp($appId, $forceEnable); |
|
| 72 | + } catch (\Exception $e) { |
|
| 73 | + $output->writeln('Error: ' . $e->getMessage()); |
|
| 74 | + return 1; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $appVersion = $this->appManager->getAppVersion($appId); |
|
| 78 | - $output->writeln($appId . ' ' . $appVersion . ' installed'); |
|
| 77 | + $appVersion = $this->appManager->getAppVersion($appId); |
|
| 78 | + $output->writeln($appId . ' ' . $appVersion . ' installed'); |
|
| 79 | 79 | |
| 80 | - if (!$input->getOption('keep-disabled')) { |
|
| 81 | - $this->appManager->enableApp($appId); |
|
| 82 | - $output->writeln($appId . ' enabled'); |
|
| 83 | - } |
|
| 80 | + if (!$input->getOption('keep-disabled')) { |
|
| 81 | + $this->appManager->enableApp($appId); |
|
| 82 | + $output->writeln($appId . ' enabled'); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return 0; |
|
| 86 | - } |
|
| 85 | + return 0; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | protected function execute(InputInterface $input, OutputInterface $output): int { |
| 59 | 59 | $appId = $input->getArgument('app-id'); |
| 60 | - $forceEnable = (bool)$input->getOption('force'); |
|
| 60 | + $forceEnable = (bool) $input->getOption('force'); |
|
| 61 | 61 | |
| 62 | 62 | try { |
| 63 | 63 | $this->appManager->getAppPath($appId); |
| 64 | - $output->writeln($appId . ' already installed'); |
|
| 64 | + $output->writeln($appId.' already installed'); |
|
| 65 | 65 | return 1; |
| 66 | 66 | } catch (AppPathNotFoundException) { |
| 67 | 67 | } |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | $this->installer->downloadApp($appId, $input->getOption('allow-unstable')); |
| 71 | 71 | $result = $this->installer->installApp($appId, $forceEnable); |
| 72 | 72 | } catch (\Exception $e) { |
| 73 | - $output->writeln('Error: ' . $e->getMessage()); |
|
| 73 | + $output->writeln('Error: '.$e->getMessage()); |
|
| 74 | 74 | return 1; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $appVersion = $this->appManager->getAppVersion($appId); |
| 78 | - $output->writeln($appId . ' ' . $appVersion . ' installed'); |
|
| 78 | + $output->writeln($appId.' '.$appVersion.' installed'); |
|
| 79 | 79 | |
| 80 | 80 | if (!$input->getOption('keep-disabled')) { |
| 81 | 81 | $this->appManager->enableApp($appId); |
| 82 | - $output->writeln($appId . ' enabled'); |
|
| 82 | + $output->writeln($appId.' enabled'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return 0; |