function _drush_flatten_options

8.0.x command.inc _drush_flatten_options($options)
6.x command.inc _drush_flatten_options($options)
7.x command.inc _drush_flatten_options($options)
5.x command.inc _drush_flatten_options($options)
master command.inc _drush_flatten_options($options)

Return the array keys of $options, plus any 'short-form' representations that may appear in the option's value.

Related topics

1 call to _drush_flatten_options()
_drush_verify_cli_options in includes/command.inc
Fail with an error if the user specified options on the command line that are not documented in the current command record.

File

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

Code

function _drush_flatten_options($options) {
  $flattened_options = array();

  foreach ($options as $key => $value) {
    // engine sections start with 'package-handler=git_drupalorg',
    // or something similar.  Get rid of everything from the = onward.
    if (($eq_pos = strpos($key, '=')) !== FALSE) {
      $key = substr($key, 0, $eq_pos);
    }
    $flattened_options[] = $key;
    if (is_array($value)) {
      if (array_key_exists('short-form', $value)) {
        $flattened_options[] = $value['short-form'];
      }
    }
  }
  return $flattened_options;
}