use Drupal\Console\Generator\PostUpdateGenerator;
use Drupal\Console\Command\Shared\ModuleTrait;
use Drupal\Console\Command\Shared\ConfirmationTrait;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Core\Command\Command;
use Drupal\Console\Extension\Manager;
use Drupal\Console\Core\Utils\ChainQueue;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
use Drupal\Console\Utils\Site;
use Drupal\Console\Utils\Validator;
{
use ModuleTrait;
use ConfirmationTrait;
- use CommandTrait;
/**
* @var Manager
{
$this
->setName('generate:post:update')
- ->setDescription($this->trans('commands.generate.post:update.description'))
+ ->setDescription($this->trans('commands.generate.post.update.description'))
->setHelp($this->trans('commands.generate.post.update.help'))
->addOption(
'module',
null,
InputOption::VALUE_REQUIRED,
$this->trans('commands.generate.post.update.options.post-update-name')
- );
+ )->setAliases(['gpu']);
}
/**
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
- // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration
- if (!$this->confirmGeneration($io)) {
+ // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmOperation
+ if (!$this->confirmOperation()) {
return 1;
}
$this->validatePostUpdateName($module, $postUpdateName);
- $this->generator->generate($module, $postUpdateName);
+ $this->generator->generate([
+ 'module' => $module,
+ 'post_update_name' => $postUpdateName,
+ ]);
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']);
protected function interact(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$this->site->loadLegacyFile('/core/includes/update.inc');
$this->site->loadLegacyFile('/core/includes/schema.inc');
- $module = $input->getOption('module');
- if (!$module) {
- // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
- $module = $this->moduleQuestion($io);
- $input->setOption('module', $module);
- }
+ // --module option
+ $this->getModuleOption();
$postUpdateName = $input->getOption('post-update-name');
if (!$postUpdateName) {
- $postUpdateName = $io->ask(
+ $postUpdateName = $this->getIo()->ask(
$this->trans('commands.generate.post.update.questions.post-update-name'),
'',
function ($postUpdateName) {
}
}
-
- protected function createGenerator()
- {
- return new PostUpdateGenerator();
- }
-
protected function getLastUpdate($module)
{
$this->site->loadLegacyFile('/core/includes/update.inc');