You are here

function drush_apachesolr_solr_variable_get in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 drush/apachesolr.drush.inc \drush_apachesolr_solr_variable_get()
  2. 7 drush/apachesolr.drush.inc \drush_apachesolr_solr_variable_get()

Command callback. List your site's variables.

File

drush/apachesolr.drush.inc, line 354
drush integration for apachesolr.

Code

function drush_apachesolr_solr_variable_get($arg_name = NULL) {
  $output = NULL;
  $found = array();
  $env_id = drush_get_option('id', apachesolr_default_environment());
  try {
    $found = _apachesolr_drush_variable_like($env_id, $arg_name);
  } catch (Exception $e) {
    return drush_set_error('APACHESOLR_ENV_ID_ERROR', $e
      ->getMessage());
  }
  foreach ($found as $name => $value) {
    drush_print_pipe(drush_format($value, $name, 'export'));
    drush_print(drush_format($value, $name));
  }
  if (empty($found)) {
    return drush_set_error('DRUSH_VARIABLE_ERROR', 'No matching variable found.');
  }
  else {
    return $found;
  }
}