function drush_get_user_selected_engine

6.x engines.inc drush_get_user_selected_engine(&$config, $engine_info)

Obtains the engine to use.

Precedence:

  • user supplied engine via cli.
  • default engine configured for the command.
  • the first engine of all available.

#TODO# clarify naming of functions and entrance point.

See also

drush_find_engine_to_use().

1 call to drush_get_user_selected_engine()
drush_load_command_engine in includes/engines.inc
Selects and loads an engine implementing the given type.

File

includes/engines.inc, line 381
The drush engines API implementation and helpers.

Code

function drush_get_user_selected_engine(&$config, $engine_info) {
  $engines = array_keys($engine_info['engines']);
  $default = isset($config['default']) ? $config['default'] : current($engines);
  if (!empty($config['option'])) {
    $selected_engine = drush_get_option($config['option'], $default);
  }
  // Otherwise the default engine is the only option.
  else {
    $selected_engine = $default;
  }
  return $selected_engine;
}