function _drush_backend_argument_string

8.0.x _drush_backend_argument_string($data, $os = NULL)
6.x _drush_backend_argument_string($data, $os = NULL)
7.x _drush_backend_argument_string($data, $os = NULL)
3.x _drush_backend_argument_string(&$data, $method = 'GET')
4.x _drush_backend_argument_string(&$data, $method = 'GET')
5.x _drush_backend_argument_string($data, $os = NULL)
master _drush_backend_argument_string($data, $os = NULL)

Map the options to a string containing all the possible arguments and options.


data: Optional. An array containing options to pass to the remote script. Array items with a numeric key are treated as optional arguments to the command. This parameter is a reference, as any options that have been represented as either an option, or an argument will be removed. This allows you to pass the left over options as a JSON encoded string, without duplicating data.

method: Optional. Defaults to 'GET'. If this parameter is set to 'POST', the $data array will be passed to the script being called as a JSON encoded string over the STDIN pipe of that process. This is preferable if you have to pass sensitive data such as passwords and the like. For any other value, the $data array will be collapsed down into a set of command line options to the script.

Return value

A properly formatted and escaped set of arguments and options to append to the drush.php shell command.

2 calls to _drush_backend_argument_string()
drush_backend_invoke_concurrent in includes/
Execute a new local or remote command in a new process.
_drush_backend_generate_command in includes/
Generate a command to execute.


includes/, line 1204
Drush backend API


function _drush_backend_argument_string($data, $os = NULL) {
  $options = array();

  foreach ($data as $key => $value) {
    if (!is_array($value) && !is_object($value) && isset($value)) {
      if (substr($key, 0, 1) != '#') {
        $options[$key] = $value;

  $option_str = '';
  foreach ($options as $key => $value) {
    $option_str .= _drush_escape_option($key, $value, $os);

  return $option_str;