You are here

function sweaver_drush_variables in Sweaver 7

Same name and namespace in other branches
  1. 6 drush/sweaver.drush.inc \sweaver_drush_variables()

Set Sweaver variables via Drush.

Parameters

$args: Arguments passed by the CLI.

Return value

$mixed Either a list of styles or start up the editor functionality.

1 string reference to 'sweaver_drush_variables'
sweaver_drush_command in drush/sweaver.drush.inc
Implementation of hook_drush_command().

File

drush/sweaver.drush.inc, line 296
Sweaver Drush functions.

Code

function sweaver_drush_variables() {
  $args = func_get_args();
  $action = sweaver_drush_verify($args, 'variables');
  switch ($action) {
    case 'list':
      drush_print(dt('Your favorite editor is currently @editor.', array(
        '@editor' => variable_get('sweaver_drush_editor', 'vi'),
      )));
      drush_print(dt('Warning message currently set to @warning.', array(
        '@warning' => variable_get('sweaver_drush_warning_edit', 'true'),
      )));
      break;
    case 'save':
      if ($args[0] == 'tmp') {
        variable_set('sweaver_drush_editor', $args[1]);
        drush_print(dt('Temporary directory set to @tmp.', array(
          '@tmp' => $args[1],
        )));
      }
      elseif ($args[0] == 'warning') {
        variable_set('sweaver_drush_warning_edit', $args[1]);
        drush_print(dt('Style warning set to @warning.', array(
          '@warning' => $args[1],
        )));
      }
      else {
        drush_print(dt('The first argument can only be "editor" or "warning"'));
      }
      break;
  }
}