function drush_redispatch_get_options

8.0.x command.inc drush_redispatch_get_options()
6.x command.inc drush_redispatch_get_options()
7.x command.inc drush_redispatch_get_options()
3.x drush.inc drush_redispatch_get_options()
4.x command.inc drush_redispatch_get_options()
5.x command.inc drush_redispatch_get_options()
master command.inc drush_redispatch_get_options()

Get the options that were passed to the current command.

This function returns an array that contains all of the options that are appropriate for forwarding along to drush_invoke_process.

Return value

An associative array of option key => value pairs.

Related topics

11 calls to drush_redispatch_get_options()
annotationcommand_adapter_get_options in includes/annotationcommand_adapter.inc
Collect all of the options defined in every relevant context, and merge them together to form the options array.
BrowseCommands::browse in lib/Drush/CommandFiles/core/BrowseCommands.php
Display a link to a given path or open link in a browser.
drush_config_edit in commands/core/config.drush.inc
Edit command callback.
drush_config_pull in commands/core/config.drush.inc
Config pull command callback
drush_core_help in commands/core/help.drush.inc
Command callback for help command. This is the default command, when none other has been specified.

... See full list

File

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

Code

function drush_redispatch_get_options() {
  $options = array();

  // Add in command-specific and alias options, but for global options only.
  $options_soup = drush_get_context('specific') + drush_get_context('alias');
  $global_option_list = drush_get_global_options(FALSE);
  foreach ($options_soup as $key => $value) {
    if (array_key_exists($key, $global_option_list)) {
      $options[$key] = $value;
    }
  }

  // Local php settings should not override sitealias settings.
  $cli_context = drush_get_context('cli');
  unset($cli_context['php'], $cli_context['php-options']);
  // Pass along CLI parameters, as higher priority.
  $options = $cli_context + $options;

  $options = array_diff_key($options, array_flip(drush_sitealias_site_selection_keys()));
  unset($options['command-specific']);
  unset($options['path-aliases']);
  // If we can parse the current command, then examine all contexts
  // in order for any option that is directly related to the current command
  $command = drush_parse_command();
  if (is_array($command)) {
    foreach (drush_get_command_options_extended($command) as $key => $value) {
      $value = drush_get_option($key);
      if (isset($value)) {
        $options[$key] = $value;
      }
    }
  }
  // If --bootstrap-to-first-arg is specified, do not
  // pass it along to remote commands.
  unset($options['bootstrap-to-first-arg']);

  return $options;
}