function _drush_flatten_options

8.0.x _drush_flatten_options($options)
6.x _drush_flatten_options($options)
7.x _drush_flatten_options($options)
5.x _drush_flatten_options($options)
master _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/
Fail with an error if the user specified options on the command line that are not documented in the current command record. Also verify that required options are present.


includes/, line 663
The drush command engine.


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;