Skip to content

Commit

Permalink
added autocomplete for package commands (#5544)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jan 28, 2023
1 parent f1cc9ad commit 7cca054
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 6 deletions.
46 changes: 46 additions & 0 deletions .tools/psalm/baseline.xml
Expand Up @@ -4125,11 +4125,57 @@
<code>rex_extension_point_console_shutdown</code>
</MissingTemplateParam>
</file>
<file src="redaxo/src/core/lib/console/package/activate.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
</file>
<file src="redaxo/src/core/lib/console/package/deactivate.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
</file>
<file src="redaxo/src/core/lib/console/package/delete.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
</file>
<file src="redaxo/src/core/lib/console/package/install.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
<UndefinedInterfaceMethod occurrences="1">
<code>ask</code>
</UndefinedInterfaceMethod>
</file>
<file src="redaxo/src/core/lib/console/package/run_update_script.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
</file>
<file src="redaxo/src/core/lib/console/package/uninstall.php">
<PossiblyNullArgument occurrences="1">
<code>$packageId</code>
</PossiblyNullArgument>
<PossiblyNullOperand occurrences="1">
<code>$packageId</code>
</PossiblyNullOperand>
</file>
<file src="redaxo/src/core/lib/console/setup/check.php">
<MixedArgument occurrences="2">
<code>$message</code>
Expand Down
14 changes: 13 additions & 1 deletion redaxo/src/core/lib/console/package/activate.php
Expand Up @@ -15,7 +15,19 @@ protected function configure()
{
$this
->setDescription('Activates the selected package')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"');
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
if ($package->isAvailable()) {
continue;
}

$packageNames[] = $package->getPackageId();
}

return $packageNames;
});
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down
14 changes: 13 additions & 1 deletion redaxo/src/core/lib/console/package/deactivate.php
Expand Up @@ -15,7 +15,19 @@ protected function configure()
{
$this
->setDescription('Deactivates the selected package')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"');
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
if (!$package->isAvailable()) {
continue;
}

$packageNames[] = $package->getPackageId();
}

return $packageNames;
});
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down
14 changes: 13 additions & 1 deletion redaxo/src/core/lib/console/package/delete.php
Expand Up @@ -15,7 +15,19 @@ protected function configure()
{
$this
->setDescription('Deletes the selected package')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"');
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
if ($package->isSystemPackage()) {
continue;
}

$packageNames[] = $package->getPackageId();
}

return $packageNames;
});
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down
11 changes: 10 additions & 1 deletion redaxo/src/core/lib/console/package/install.php
Expand Up @@ -16,7 +16,16 @@ protected function configure()
{
$this
->setDescription('Installs the selected package')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
// allow all packages, because we support --re-intall for already installed ones
$packageNames[] = $package->getPackageId();
}

return $packageNames;
})
->addOption('re-install', '-r', InputOption::VALUE_NONE, 'Allows to reinstall the Package without asking the User');
}

Expand Down
14 changes: 13 additions & 1 deletion redaxo/src/core/lib/console/package/run_update_script.php
Expand Up @@ -15,7 +15,19 @@ protected function configure()
{
$this
->setDescription('Runs the update.php of the given package with given previous version')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
if (!$package->isInstalled()) {
continue;
}

$packageNames[] = $package->getPackageId();
}

return $packageNames;
})
->addArgument('previous-version', InputArgument::REQUIRED, 'The previous package version that is used for version comparisons in update.php')
;
}
Expand Down
14 changes: 13 additions & 1 deletion redaxo/src/core/lib/console/package/uninstall.php
Expand Up @@ -15,7 +15,19 @@ protected function configure()
{
$this
->setDescription('Uninstalls the selected package')
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"');
->addArgument('package-id', InputArgument::REQUIRED, 'The id of the package (addon or plugin); e.g. "cronjob" or "structure/content"', null, static function () {
$packageNames = [];

foreach (rex_package::getRegisteredPackages() as $package) {
if (!$package->isInstalled()) {
continue;
}

$packageNames[] = $package->getPackageId();
}

return $packageNames;
});
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand Down

0 comments on commit 7cca054

Please sign in to comment.