namespace Drupal\Console\Command\Module;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
+use Drupal\Console\Core\Command\Command;
use Drupal\Console\Command\Shared\ProjectDownloadTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Utils\DrupalApi;
use GuzzleHttp\Client;
use Drupal\Console\Extension\Manager;
class DownloadCommand extends Command
{
- use CommandTrait;
use ProjectDownloadTrait;
/**
'unstable',
null,
InputOption::VALUE_NONE,
- $this->trans('commands.module.install.options.unstable')
- );
+ $this->trans('commands.module.download.options.unstable')
+ )
+ ->setAliases(['mod']);
}
/**
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
$composer = $input->getOption('composer');
$module = $input->getArgument('module');
if (!$module) {
- $module = $this->modulesQuestion($io);
+ $module = $this->modulesQuestion();
$input->setArgument('module', $module);
}
if (!$composer) {
$path = $input->getOption('path');
if (!$path) {
- $path = $io->ask(
+ $path = $this->getIo()->ask(
$this->trans('commands.module.download.questions.path'),
'modules/contrib'
);
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$modules = $input->getArgument('module');
$latest = $input->getOption('latest');
$path = $input->getOption('path');
->getPackagistModuleReleases($module, 10, $unstable);
if (!$versions) {
- $io->error(
+ $this->getIo()->error(
sprintf(
$this->trans(
'commands.module.download.messages.no-releases'
return 1;
} else {
- $version = $io->choice(
+ $version = $this->getIo()->choice(
sprintf(
$this->trans(
'commands.site.new.questions.composer-release'
->getPackagistModuleReleases($module, 10, $unstable);
if (!$versions) {
- $io->error(
+ $this->getIo()->error(
sprintf(
$this->trans(
'commands.module.download.messages.no-releases'
}
// Register composer repository
- $command = "composer config repositories.drupal composer https://packagist.drupal-composer.org";
+ $command = "composer config repositories.drupal composer https://packages.drupal.org/8";
$this->shellProcess->exec($command, $this->root);
$command = sprintf(
);
if ($this->shellProcess->exec($command, $this->root)) {
- $io->success(
+ $this->getIo()->success(
sprintf(
$this->trans('commands.module.download.messages.composer'),
$module
}
}
} else {
- $this->downloadModules($io, $modules, $latest, $path);
+ $this->downloadModules($modules, $latest, $path);
}
return true;