コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $application = $this->getApplication();
     $drupal = $this->getDrupalHelper();
     // Provide drupal version if it's installed
     $drupalVersion = $this->trans('commands.site.status.messages.not_installed');
     if ($drupal->isInstalled()) {
         $drupalVersion = sprintf($this->trans('commands.site.status.messages.current_version'), $this->getSite()->getDrupalVersion());
     }
     $aboutTitle = sprintf('%s (%s) | Supports Drupal (%s) | %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_SUPPORTED_VERSION, $drupalVersion);
     $io->setDecorated(false);
     $io->title($aboutTitle);
     $io->setDecorated(true);
     $commands = ['init' => [$this->trans('commands.init.description'), 'drupal init --override'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_SUPPORTED_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
     foreach ($commands as $command => $commandInfo) {
         $io->writeln($commandInfo[0]);
         $io->newLine();
         $io->comment(sprintf('  %s', $commandInfo[1]));
         $io->newLine();
     }
     $io->setDecorated(false);
     $io->section($this->trans('commands.self-update.description'));
     $io->setDecorated(true);
     $io->comment('  drupal self-update');
     $io->newLine();
 }
コード例 #2
0
 /**
  * @param ConsoleCommandEvent $event
  */
 public function showMessage(ConsoleCommandEvent $event)
 {
     /**
      * @var \Drupal\Console\Command\Command $command
      */
     $command = $event->getCommand();
     $input = $event->getInput();
     $output = $event->getOutput();
     $output = new DrupalStyle($input, $output);
     $application = $command->getApplication();
     $translatorHelper = $application->getTranslator();
     $welcomeMessageKey = 'commands.' . str_replace(':', '.', $command->getName()) . '.welcome';
     $welcomeMessage = $translatorHelper->trans($welcomeMessageKey);
     if ($welcomeMessage != $welcomeMessageKey) {
         $output->title($welcomeMessage);
     }
 }
コード例 #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new DrupalStyle($input, $output);
     $application = $this->getApplication();
     $aboutTitle = sprintf('%s (%s) | Supports Drupal %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_VERSION);
     $output->setDecorated(false);
     $output->title($aboutTitle);
     $output->setDecorated(true);
     $commands = ['init' => [$this->trans('commands.init.description'), 'drupal init [--override]'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
     foreach ($commands as $command => $commandInfo) {
         $output->writeln($commandInfo[0]);
         $output->newLine();
         $output->writeln(sprintf('  <comment>%s</comment>', $commandInfo[1]));
         $output->newLine();
     }
     $output->setDecorated(false);
     $output->section($this->trans('commands.self-update.description'));
     $output->setDecorated(true);
     $output->writeln('  <comment>drupal self-update</comment>');
     $output->newLine();
 }