function drush_command_default_options

8.0.x command.inc drush_command_default_options($command = NULL)
6.x command.inc drush_command_default_options($command = NULL)
7.x command.inc drush_command_default_options($command = NULL)
3.x command.inc drush_command_default_options($command = NULL)
4.x command.inc drush_command_default_options($command = NULL)
5.x command.inc drush_command_default_options($command = NULL)
master command.inc drush_command_default_options($command = NULL)

Conditionally include default options based on the command used.

2 calls to drush_command_default_options()
drush_dispatch in includes/drush.inc
Dispatch a given set of commands. Modules can add commands by implementing hook_drush_command().
drush_set_config_special_contexts in includes/context.inc
There are certain options such as 'site-aliases' and 'command-specific' that must be merged together if defined in multiple drush configuration files. If we did not do this merge, then the last configuration file that defined any…

File

includes/command.inc, line 624
The drush command engine.

Code

function drush_command_default_options($command = NULL) {
  if (!$command) {
    $command = drush_get_command();
  }
  if ($command) {
    // Look for command-specific options for this command
    // keyed both on the command's primary name, and on each
    // of its aliases.
    $options_were_set = _drush_command_set_default_options($command['command']);
    if (isset($command['aliases']) && count($command['aliases'])) {
      foreach ($command['aliases'] as $alias) {
        if (_drush_command_set_default_options($alias) === TRUE) {
          $options_were_set = TRUE;
        }
      }
    }
    // Take the time here to clear out any options that may
    // have "--no-xxx" overrides on the command line.
    $commandline_options = drush_get_context('options');
    foreach ($commandline_options as $key => $value) {
      if (substr($key, 0, strlen("no-")) == "no-") {
        drush_unset_option(substr($key, strlen("no-")));
        $options_were_set = TRUE;
      }
    }
    // If we set or cleared any options, go back and re-bootstrap any global
    // options such as -y and -v.
    if ($options_were_set) {
      _drush_bootstrap_global_options();
    }
  }
}