function drush_get_user_selected_engine

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

Obtains the engine to use.


  • 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


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


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


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;