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;
22 * @package Drupal\Console\Core\Command\Exclude
24 class DrushCommand extends Command
29 * @var ConfigurationManager
31 protected $configurationManager;
36 protected $chainQueue;
39 * DrushCommand constructor.
41 * @param ConfigurationManager $configurationManager
42 * @param ChainQueue $chainQueue
44 public function __construct(
45 ConfigurationManager $configurationManager,
46 ChainQueue $chainQueue
48 $this->configurationManager = $configurationManager;
49 $this->chainQueue = $chainQueue;
50 parent::__construct();
56 protected function configure()
60 ->setDescription($this->trans('commands.drush.description'))
63 InputArgument::OPTIONAL,
64 $this->trans('commands.drush.arguments.command-name'),
72 protected function execute(InputInterface $input, OutputInterface $output)
74 $io = new DrupalStyle($input, $output);
75 $commandName = $input->getArgument('command-name');
77 $alternative = $this->configurationManager->readDrushEquivalents($commandName);
80 $io->info($this->trans('commands.drush.description'));
84 $io->error($this->trans('commands.drush.messages.not-found'));
89 $tableHeader = ['drush','drupal console'];
90 if (is_array($alternative)) {
101 [[$commandName, $alternative]]
104 if ($this->getApplication()->has($alternative)) {
105 $this->chainQueue->addCommand(
107 ['command_name' => $alternative]