Skip to content

Commit

Permalink
[generate:site:alias] Add site option flag. (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Mar 21, 2018
1 parent ca73336 commit ee05e91
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Command/Generate/SiteAliasCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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'),
Expand All @@ -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'),
Expand All @@ -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
]
);
}
Expand Down

0 comments on commit ee05e91

Please sign in to comment.