Chris@17: setName('quick-start') Chris@17: ->setDescription('Installs a Drupal site and runs a web server. This is not meant for production and might be too simple for custom development. It is a quick and easy way to get Drupal running.') Chris@17: ->addArgument('install-profile', InputArgument::OPTIONAL, 'Install profile to install the site in.') Chris@17: ->addOption('langcode', NULL, InputOption::VALUE_OPTIONAL, 'The language to install the site in. Defaults to en.', 'en') Chris@17: ->addOption('site-name', NULL, InputOption::VALUE_OPTIONAL, 'Set the site name. Defaults to Drupal.', 'Drupal') Chris@17: ->addOption('host', NULL, InputOption::VALUE_OPTIONAL, 'Provide a host for the server to run on. Defaults to 127.0.0.1.', '127.0.0.1') Chris@17: ->addOption('port', NULL, InputOption::VALUE_OPTIONAL, 'Provide a port for the server to run on. Will be determined automatically if none supplied.') Chris@17: ->addOption('suppress-login', 's', InputOption::VALUE_NONE, 'Disable opening a login URL in a browser.') Chris@17: ->addUsage('demo_umami --langcode fr') Chris@17: ->addUsage('standard --site-name QuickInstall --host localhost --port 8080') Chris@17: ->addUsage('minimal --host my-site.com --port 80'); Chris@17: Chris@17: parent::configure(); Chris@17: } Chris@17: Chris@17: /** Chris@17: * {@inheritdoc} Chris@17: */ Chris@17: protected function execute(InputInterface $input, OutputInterface $output) { Chris@17: $command = $this->getApplication()->find('install'); Chris@17: Chris@17: $arguments = [ Chris@17: 'command' => 'install', Chris@17: 'install-profile' => $input->getArgument('install-profile'), Chris@17: '--langcode' => $input->getOption('langcode'), Chris@17: '--site-name' => $input->getOption('site-name'), Chris@17: ]; Chris@17: Chris@17: $installInput = new ArrayInput($arguments); Chris@17: $returnCode = $command->run($installInput, $output); Chris@17: Chris@17: if ($returnCode === 0) { Chris@17: $command = $this->getApplication()->find('server'); Chris@17: $arguments = [ Chris@17: 'command' => 'server', Chris@17: '--host' => $input->getOption('host'), Chris@17: '--port' => $input->getOption('port'), Chris@17: ]; Chris@17: if ($input->getOption('suppress-login')) { Chris@17: $arguments['--suppress-login'] = TRUE; Chris@17: } Chris@17: $serverInput = new ArrayInput($arguments); Chris@17: $returnCode = $command->run($serverInput, $output); Chris@17: } Chris@17: return $returnCode; Chris@17: } Chris@17: Chris@17: }