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\Style\DrupalStyle;
+use Drupal\Console\Core\Command\Command;
use Drupal\Console\Command\Shared\ProjectDownloadTrait;
use Drupal\Console\Core\Utils\ShellProcess;
class UpdateCommand extends Command
{
- use CommandTrait;
use ProjectDownloadTrait;
null,
InputOption::VALUE_NONE,
$this->trans('commands.module.update.options.simulate')
- );
+ )->setAliases(['moup']);
}
/**
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
$composer = $input->getOption('composer');
$module = $input->getArgument('module');
if (!$composer) {
- $io->error($this->trans('commands.module.update.messages.only-composer'));
+ $this->getIo()->error($this->trans('commands.module.update.messages.only-composer'));
return 1;
}
if (!$module) {
- $module = $this->modulesQuestion($io);
+ $module = $this->modulesQuestion();
$input->setArgument('module', $module);
}
}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$modules = $input->getArgument('module');
$composer = $input->getOption('composer');
$simulate = $input->getOption('simulate');
if (!$composer) {
- $io->error($this->trans('commands.module.update.messages.only-composer'));
+ $this->getIo()->error($this->trans('commands.module.update.messages.only-composer'));
return 1;
}
if (!$modules) {
- $io->error(
+ $this->getIo()->error(
$this->trans('commands.module.update.messages.missing-module')
);
if ($composer) {
// 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 = 'composer update ' . $modules . ' --optimize-autoloader --prefer-dist --no-dev --root-reqs ';
}
if ($this->shellProcess->exec($command, $this->root)) {
- $io->success(
+ $this->getIo()->success(
sprintf(
$this->trans('commands.module.update.messages.composer'),
trim($modules)