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 Symfony\Component\Console\Command\Command;
15 use Drupal\Console\Core\Command\Shared\CommandTrait;
16 use Drupal\Console\Core\Style\DrupalStyle;
17 use Drupal\Console\Command\Shared\ProjectDownloadTrait;
18 use Drupal\Console\Utils\DrupalApi;
19 use GuzzleHttp\Client;
21 class DownloadCommand extends Command
23 use ProjectDownloadTrait;
35 protected $httpClient;
44 * DownloadCommand constructor.
46 * @param DrupalApi $drupalApi
47 * @param Client $httpClient
50 public function __construct(
55 $this->drupalApi = $drupalApi;
56 $this->httpClient = $httpClient;
57 $this->appRoot = $appRoot;
58 parent::__construct();
65 protected function configure()
68 ->setName('theme:download')
69 ->setDescription($this->trans('commands.theme.download.description'))
70 ->addArgument('theme', InputArgument::REQUIRED, $this->trans('commands.theme.download.arguments.theme'))
71 ->addArgument('version', InputArgument::OPTIONAL, $this->trans('commands.theme.download.arguments.version'))
75 InputOption::VALUE_NONE,
76 $this->trans('commands.theme.download.options.composer')
83 protected function execute(InputInterface $input, OutputInterface $output)
85 $io = new DrupalStyle($input, $output);
87 $theme = $input->getArgument('theme');
88 $version = $input->getArgument('version');
89 $composer = $input->getOption('composer');
92 if (!is_array($theme)) {
95 $this->get('chain_queue')->addCommand(
105 $this->downloadProject($io, $theme, $version, 'theme');
112 protected function interact(InputInterface $input, OutputInterface $output)
114 $io = new DrupalStyle($input, $output);
116 $theme = $input->getArgument('theme');
117 $version = $input->getArgument('version');
118 $composer = $input->getOption('composer');
120 if (!$version && !$composer) {
121 $version = $this->releasesQuestion($io, $theme);
122 $input->setArgument('version', $version);