From ee05e91d5a138c0219f22fcca323399f39d6d542 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 21 Mar 2018 12:20:43 -0700 Subject: [PATCH] [generate:site:alias] Add site option flag. (#336) --- src/Command/Generate/SiteAliasCommand.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Command/Generate/SiteAliasCommand.php b/src/Command/Generate/SiteAliasCommand.php index 9ba3e2d..835afe1 100644 --- a/src/Command/Generate/SiteAliasCommand.php +++ b/src/Command/Generate/SiteAliasCommand.php @@ -77,6 +77,12 @@ protected function configure() $this->trans('commands.generate.site.alias.description') ) ->setHelp($this->trans('commands.generate.site.alias.help')) + ->addOption( + 'site', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.site.alias.options.site') + ) ->addOption( 'name', null, @@ -147,6 +153,7 @@ protected function interact( InputInterface $input, OutputInterface $output ) { + $site = $input->getOption('site'); $name = $input->getOption('name'); if (!$name) { $sites = $this->configurationManager->getSites(); @@ -269,6 +276,10 @@ protected function interact( } $directory = $input->getOption('directory'); + if ($site && $this->drupalFinder->getComposerRoot()) { + $directory = $this->drupalFinder->getComposerRoot() . '/console/'; + } + if (!$directory) { $directory = $this->getIo()->choice( $this->trans('commands.generate.site.alias.questions.directory'), @@ -286,6 +297,11 @@ protected function execute( InputInterface $input, OutputInterface $output ) { + $site = $input->getOption('site'); + $directory = $input->getOption('directory'); + if ($site && $this->drupalFinder->isValidDrupal()) { + $directory = $this->drupalFinder->getComposerRoot() . '/console/'; + } $this->generator->generate( [ 'name' => $input->getOption('name'), @@ -297,7 +313,7 @@ protected function execute( 'port' => $input->getOption('port'), 'user' => $input->getOption('user'), 'host' => $input->getOption('host'), - 'directory' => $input->getOption('directory') + 'directory' => $directory ] ); }