diff --git a/src/Commands/core/EditCommands.php b/src/Commands/core/EditCommands.php index 8683ba1fec..2ce890a785 100644 --- a/src/Commands/core/EditCommands.php +++ b/src/Commands/core/EditCommands.php @@ -3,9 +3,12 @@ use Drush\Commands\DrushCommands; use Drush\Drush; +use Drush\SiteAlias\SiteAliasManagerAwareInterface; +use Drush\SiteAlias\SiteAliasManagerAwareTrait; -class EditCommands extends DrushCommands +class EditCommands extends DrushCommands implements SiteAliasManagerAwareInterface { + use SiteAliasManagerAwareTrait; /** * Edit drushrc, site alias, and Drupal settings.php files. @@ -72,15 +75,17 @@ public function load($headers = true) } } - if ($rcs = drush_get_context_options('context-path', true)) { + if ($rcs = Drush::config()->get('runtime.config.paths')) { + // @todo filter out any files that are within Drush. + $rcs = array_combine($rcs, $rcs); if ($headers) { $rcs_header = array('drushrc' => '-- Drushrc --'); } } - // TODO: List alias files - $aliases = []; - if (!empty($aliases)) { - $aliases = drush_map_assoc($aliases); + + if ($aliases = $this->siteAliasManager()->listAllFilePaths()) { + sort($aliases); + $aliases = array_combine($aliases, $aliases); if ($headers) { $aliases_header = array('aliases' => '-- Aliases --'); } @@ -98,11 +103,8 @@ public function load($headers = true) $drupal_header = array('drupal' => '-- Drupal --'); } } - // TODO: how can we get a list of Drush commands and their paths? - $commands = []; // drush_get_commands(); - ksort($commands); - return array_merge($php_header, $php, $bash_header, $bash, $rcs_header, $rcs, $aliases_header, $aliases, $commandfiles_header, $commandfiles, $drupal_header, $drupal); + return array_merge($php_header, $php, $bash_header, $bash, $rcs_header, $rcs, $aliases_header, $aliases, $drupal_header, $drupal); } public static function phpIniFiles()