You are here

function drush_variable_realm_get in Variable 7.2

Drush command callback. List realm's variables.

File

variable_realm/variable_realm.drush.inc, line 92
Drush commands for Variable Realm.

Code

function drush_variable_realm_get($realm_name, $realm_key, $variable_name) {
  if ($variable_name) {
    $variables[$variable_name] = variable_realm_get($realm_name, $realm_key, $variable_name);
  }
  else {
    $variables = variable_realm($realm_name, $realm_key)
      ->variable_list();
  }
  foreach ($variables as $name => $value) {
    drush_print_pipe(drush_format($value, $name, 'export'));
    drush_print(drush_format($value, $name));
    $returns[$name] = $value;
  }
  if (empty($variables)) {
    return drush_set_error('No matching variable found.');
  }
  else {
    return $returns;
  }
}