function drush_get_original_cli_args_and_options

8.0.x command.inc drush_get_original_cli_args_and_options($command = NULL)
6.x command.inc drush_get_original_cli_args_and_options($command = NULL)
7.x command.inc drush_get_original_cli_args_and_options($command = NULL)
5.x command.inc drush_get_original_cli_args_and_options($command = NULL)
master command.inc drush_get_original_cli_args_and_options($command = NULL)

Return the original cli args and options, exactly as they appeared on the command line, and in the same order. Any command-specific options that were set will also appear in this list, appended at the very end.

The args and options returned are raw, and must be escaped as necessary before use.

3 calls to drush_get_original_cli_args_and_options()
drush_core_execute in commands/core/core.drush.inc
Command callback. Execute specified shell code. Often used by shell aliases that start with !.
drush_core_rsync in commands/core/rsync.core.inc
A command callback.
drush_ssh_site_ssh in commands/core/ssh.drush.inc
Command callback.

File

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

Code

function drush_get_original_cli_args_and_options($command = NULL) {
  $args = drush_get_context('DRUSH_COMMAND_ARGS', array());
  $command_specific_options = drush_get_context('specific');
  if ($command == NULL) {
    $command = drush_get_command();
  }
  $command_options = ($command == NULL) ? array() : _drush_get_command_options($command);
  foreach ($command_specific_options as $key => $value) {
    if (!array_key_exists($key, $command_options)) {
      if (($value === TRUE) || (!isset($value))) {
        $args[] = "--$key";
      }
      else {
        $args[] = "--$key=$value";
      }
    }
  }
  return $args;
}