function _drush_sitealias_user_specified_list

8.0.x sitealias.drush.inc _drush_sitealias_user_specified_list()
6.x sitealias.drush.inc _drush_sitealias_user_specified_list()
7.x sitealias.drush.inc _drush_sitealias_user_specified_list()
3.x sitealias.drush.inc _drush_sitealias_user_specified_list()
4.x sitealias.drush.inc _drush_sitealias_user_specified_list()
5.x sitealias.drush.inc _drush_sitealias_user_specified_list()
master sitealias.drush.inc _drush_sitealias_user_specified_list()

Return the list of site aliases (remote or local) that the user specified on the command line. If none were specified, then all are returned.

1 call to _drush_sitealias_user_specified_list()
drush_sitealias_print in commands/core/sitealias.drush.inc
Print out the specified site aliases (or else all) using the format specified.

File

commands/core/sitealias.drush.inc, line 138
Site alias commands.

Code

function _drush_sitealias_user_specified_list() {
  $command = drush_get_command();
  $specifications = $command['arguments'];
  $site_list = array();

  // Iterate over the arguments and convert them to alias records
  if (!empty($specifications)) {
    list($site_list, $not_found) = drush_sitealias_resolve_sitespecs($specifications);
    if (!empty($not_found)) {
      return drush_set_error('DRUSH_ALIAS_NOT_FOUND', dt("Not found: @list", array("@list" => implode(', ', $not_found))));
    }
  }
  // If the user provided no args, then we will return everything.
  else {
    drush_set_default_outputformat('list');
    $site_list = _drush_sitealias_all_list();

    // Filter out the hidden items
    foreach ($site_list as $site_name => $one_site) {
      if (array_key_exists('#hidden', $one_site)) {
        unset($site_list[$site_name]);
      }
    }
  }

  // Filter for only local sites if specified.
  if (drush_get_option('local-only', FALSE)) {
    foreach ($site_list as $site_name => $one_site) {
      if ((array_key_exists('remote-site', $one_site)) || (!array_key_exists('root', $one_site)) || (!is_dir($one_site['root']))) {
        unset($site_list[$site_name]);
      }
    }
  }
  return $site_list;
}