5 * Contains \Drupal\Console\Core\Command\Exclude\DrushCommand.
8 namespace Drupal\Console\Core\Command;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Input\InputArgument;
13 use Drupal\Console\Core\Utils\ConfigurationManager;
14 use Drupal\Console\Core\Utils\ChainQueue;
19 * @package Drupal\Console\Core\Command
21 class DrushCommand extends Command
24 * @var ConfigurationManager
26 protected $configurationManager;
31 protected $chainQueue;
34 * DrushCommand constructor.
36 * @param ConfigurationManager $configurationManager
37 * @param ChainQueue $chainQueue
39 public function __construct(
40 ConfigurationManager $configurationManager,
41 ChainQueue $chainQueue
43 $this->configurationManager = $configurationManager;
44 $this->chainQueue = $chainQueue;
45 parent::__construct();
51 protected function configure()
55 ->setDescription($this->trans('commands.drush.description'))
58 InputArgument::OPTIONAL,
59 $this->trans('commands.drush.arguments.command-name'),
67 protected function execute(InputInterface $input, OutputInterface $output)
69 $commandName = $input->getArgument('command-name');
71 $alternative = $this->configurationManager->readDrushEquivalents($commandName);
73 $this->getIo()->newLine();
74 $this->getIo()->info($this->trans('commands.drush.description'));
75 $this->getIo()->newLine();
78 $this->getIo()->error($this->trans('commands.drush.messages.not-found'));
83 $tableHeader = ['drush','drupal console'];
84 if (is_array($alternative)) {
85 $this->getIo()->table(
93 $this->getIo()->table(
95 [[$commandName, $alternative]]
98 if ($this->getApplication()->has($alternative)) {
99 $this->chainQueue->addCommand(
101 ['command_name' => $alternative]