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

7 calls to drush_redispatch_get_options()
drush_browse in commands/core/browse.drush.inc
Command callback.
drush_config_pull in commands/core/config.drush.inc
Config pull command callback
drush_do_command_redispatch in includes/drush.inc
Redispatch the specified command using the same options that were passed to this invocation of drush.
drush_preflight_command_dispatch in includes/preflight.inc
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).
drush_sqlsync_sql_sync in commands/sql/sqlsync.drush.inc

... See full list

File

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

Code

function drush_redispatch_get_options() {
  // Start off by taking everything from the site alias and command line
  // ('cli' context)
  $cli_context = drush_get_context('cli');
  // local php settings should not override sitealias settings
  unset($cli_context['php']);
  unset($cli_context['php-options']);
  // cli overrides and command specific
  $options = $cli_context + drush_get_context('specific');
  $global_option_list = drush_get_global_options(FALSE);
  foreach (drush_get_context('alias') as $key => $value) {
    if (array_key_exists($key, $global_option_list)) {
      $options[$key] = $value;
    }
  }

  $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 ($command['options'] as $key => $value) {
      // Strip leading --
      $key = ltrim($key, '-');
      $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;
}