You are here

function drush_environment_list in Environment 8

Implements drush_hook_COMMAND for environment.

Render all current environments with full description.

File

./environment.drush.inc, line 70
Executes the environment_switch capabilities.

Code

function drush_environment_list() {
  $environments = environment_load();
  $drush_context = drush_get_context('DRUSH_PIPE') ? 'drush_print_pipe' : 'drush_print_table';
  if (isset($environments)) {
    $items = array();
    foreach ($environments as $environment) {
      $items[$environment
        ->get('id')] = $environment
        ->get('label');
    }
    if ($drush_context == 'drush_print_pipe') {
      drush_print_pipe($items);
    }
    else {
      drush_print_table(drush_key_value_to_array_table($items));
    }
  }
  return;
}