You are here

function drush_apachesolr_solr_variable_get in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 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. much of it copied from drush core

Parameters

string $arg_name:

Return value

array|mixed Could be the variable or a drush error

File

drush/apachesolr.drush.inc, line 414
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;
  }
}