Skip to content

Commit

Permalink
Fixes #3028: make 'drush @self command' equivalent to 'drush command' (
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson authored Oct 6, 2017
1 parent 68ee17f commit 213774f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ command line options just for Drush to work.
If you wish to be able to select your Drupal site implicitly from the
current working directory without using the --uri option, but you need your
base_url to be set correctly, you may force it by setting the uri in
a config.yml file located in the same directory as your settings.php file.
a drush.yml file located in the same directory as your settings.php file.

```
uri: "http://example.com"
Expand Down
4 changes: 4 additions & 0 deletions src/Preflight/PreflightArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public function hasAlias()
*/
public function setAlias($alias)
{
// Treat `drush @self ...` as if an alias had not been used at all.
if ($alias == '@self') {
$alias = '';
}
return $this->set(self::ALIAS, $alias);
}

Expand Down
10 changes: 6 additions & 4 deletions src/SiteAlias/SiteAliasManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,15 @@ protected function buildSelf(PreflightArgsInterface $preflightArgs, Environment
}

// If the user provides the --root parameter then we don't want to use
// the site alias.
// the site-set alias.
$selectedRoot = $preflightArgs->selectedSite();
if (!$selectedRoot) {
$aliasName = $environment->getSiteSetAliasName();
$alias = $this->getAlias($aliasName);
if ($alias) {
return $alias;
if (!empty($aliasName)) {
$alias = $this->getAlias($aliasName);
if ($alias) {
return $alias;
}
}
}

Expand Down

0 comments on commit 213774f

Please sign in to comment.