5 * Contains \Drupal\Console\Core\Command\Exclude\DrushCommand.
8 namespace Drupal\Console\Core\Command\Exclude;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Input\InputArgument;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\Console\Core\Command\Shared\CommandTrait;
15 use Drupal\Console\Core\Utils\ConfigurationManager;
16 use Drupal\Console\Core\Utils\ChainQueue;
17 use Drupal\Console\Core\Style\DrupalStyle;
21 * @package Drupal\Console\Core\Command\Exclude
23 class DrushCommand extends Command
28 * @var ConfigurationManager
30 protected $configurationManager;
35 protected $chainQueue;
38 * DrushCommand constructor.
39 * @param ConfigurationManager $configurationManager
40 * @param ChainQueue $chainQueue
42 public function __construct(
43 ConfigurationManager $configurationManager,
44 ChainQueue $chainQueue
46 $this->configurationManager = $configurationManager;
47 $this->chainQueue = $chainQueue;
48 parent::__construct();
54 protected function configure()
58 ->setDescription($this->trans('commands.drush.description'))
61 InputArgument::OPTIONAL,
62 $this->trans('commands.drush.arguments.command-name'),
70 protected function execute(InputInterface $input, OutputInterface $output)
72 $io = new DrupalStyle($input, $output);
73 $commandName = $input->getArgument('command-name');
75 $alternative = $this->configurationManager->readDrushEquivalents($commandName);
78 $io->info($this->trans('commands.drush.description'));
82 $io->error($this->trans('commands.drush.messages.not-found'));
87 $tableHeader = ['drush','drupal console'];
88 if (is_array($alternative)) {
99 [[$commandName, $alternative]]
102 if ($this->getApplication()->has($alternative)) {
103 $this->chainQueue->addCommand(
105 ['command_name' => $alternative]