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 ] ); }