5 * Contains \Drupal\Console\Command\Theme\DownloadCommand.
8 namespace Drupal\Console\Command\Theme;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputOption;
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
14 use Drupal\Console\Core\Command\Command;
15 use Drupal\Console\Command\Shared\ProjectDownloadTrait;
16 use Drupal\Console\Utils\DrupalApi;
17 use GuzzleHttp\Client;
19 class DownloadCommand extends Command
21 use ProjectDownloadTrait;
31 protected $httpClient;
40 * DownloadCommand constructor.
42 * @param DrupalApi $drupalApi
43 * @param Client $httpClient
46 public function __construct(
51 $this->drupalApi = $drupalApi;
52 $this->httpClient = $httpClient;
53 $this->appRoot = $appRoot;
54 parent::__construct();
61 protected function configure()
64 ->setName('theme:download')
65 ->setDescription($this->trans('commands.theme.download.description'))
68 InputArgument::REQUIRED,
69 $this->trans('commands.theme.download.arguments.theme')
73 InputArgument::OPTIONAL,
74 $this->trans('commands.theme.download.arguments.version')
79 InputOption::VALUE_NONE,
80 $this->trans('commands.theme.download.options.composer')
81 )->setAliases(['thd']);
87 protected function execute(InputInterface $input, OutputInterface $output)
89 $theme = $input->getArgument('theme');
90 $version = $input->getArgument('version');
91 $composer = $input->getOption('composer');
94 if (!is_array($theme)) {
97 $this->get('chain_queue')->addCommand(
107 $this->downloadProject($theme, $version, 'theme');
114 protected function interact(InputInterface $input, OutputInterface $output)
116 $theme = $input->getArgument('theme');
117 $version = $input->getArgument('version');
118 $composer = $input->getOption('composer');
120 if (!$version && !$composer) {
121 $version = $this->releasesQuestion($theme);
122 $input->setArgument('version', $version);