function drush_sitealias_print

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

Print out the specified site aliases using the format specified.

1 string reference to 'drush_sitealias_print'

File

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

Code

function drush_sitealias_print() {
  // Call bootstrap max, unless the caller requested short output
  if (!drush_get_option('short', FALSE)) {
    drush_bootstrap_max();
  }

  $site_list = _drush_sitealias_user_specified_list();
  $full_output = drush_get_option('full');
  $long_output = drush_get_option('long');
  $with_db = (drush_get_option('with-db') != null) || (drush_get_option('with-db-url') != null);

  $site_specs = array();
  foreach ($site_list as $site => $alias_record) {
    if (!array_key_exists('site-list', $alias_record)) {
      $site_specs[] = drush_sitealias_alias_record_to_spec($alias_record, $with_db);
    }
    if (isset($full_output)) {
      $component = drush_get_option('component');
      if ($component) {
        if (array_key_exists($component, $alias_record)) {
          drush_print($alias_record[$component]);
        }
        else {
          drush_set_error('DRUSH_NO_SUCH_ELEMENT', dt('The element @component was not found in the alias record for @site.', array('@component' => $component, '@site' => $site)));
        }
      }
      else {
        _drush_sitealias_print_record($alias_record, $site);
      }
    }
    else {
      drush_print($site);
    }
  }
  drush_print_pipe(array_unique($site_specs));
}