Skip to content

Commit

Permalink
Use the \#AsCommand() annotation
Browse files Browse the repository at this point in the history
Improves the performance of the 'list' command
  • Loading branch information
jigarius committed Jan 7, 2025
1 parent 9eb2605 commit f92a4e9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
13 changes: 6 additions & 7 deletions src/Command/SiteAliasesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

namespace Drall\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* A command to get a list of site aliases in the Drupal installation.
*/
#[AsCommand(
name: 'site:aliases',
description: 'List all Drush site aliases.',
aliases: ['sa']
)]
class SiteAliasesCommand extends BaseCommand {

protected function configure() {
parent::configure();

$this->setName('site:aliases');
$this->setAliases(['sa']);
$this->setDescription('List all Drush site aliases.');
$this->addUsage('site:aliases');
$this->addUsage('--group=GROUP site:aliases');
$this->addUsage('--filter=FILTER site:aliases');
Expand Down
13 changes: 6 additions & 7 deletions src/Command/SiteDirectoriesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

namespace Drall\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* A command to get a list of values in the $sites array.
*/
#[AsCommand(
name: 'site:directories',
description: 'List the values of the $sites array.',
aliases: ['sd'],
)]
class SiteDirectoriesCommand extends BaseCommand {

protected function configure() {
parent::configure();

$this->setName('site:directories');
$this->setAliases(['sd']);
$this->setDescription('List the values of the $sites array.');
$this->addUsage('site:directories');
$this->addUsage('--group=GROUP site:directories');
}
Expand Down
13 changes: 6 additions & 7 deletions src/Command/SiteKeysCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

namespace Drall\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* A command to get a list of keys in the $sites array.
*/
#[AsCommand(
name: 'site:keys',
description: 'List the keys of the $sites array.',
aliases: ['sk'],
)]
class SiteKeysCommand extends BaseCommand {

protected function configure() {
parent::configure();

$this->setName('site:keys');
$this->setAliases(['sk']);
$this->setDescription('List the keys of the $sites array.');
$this->addUsage('site:keys');
$this->addUsage('--group=GROUP site:keys');
$this->addUsage('--filter=FILTER site:keys');
Expand Down

0 comments on commit f92a4e9

Please sign in to comment.