function drush_complete_get

8.0.x drush_complete_get($type, $command = NULL)
6.x drush_complete_get($type, $command = NULL)
7.x drush_complete_get($type, $command = NULL)
5.x drush_complete_get($type, $command = NULL)
master drush_complete_get($type, $command = NULL)

Retrieves from cache, or generates a listing of completion candidates of a specific type (and optionally, command).


string $type: String indicating type of completions to return. See drush_complete_rebuild() for possible keys.

string $command: An optional command name if command specific completion is needed.

Return value

array List of candidate completions.

1 call to drush_complete_get()
drush_early_complete in includes/
Produce autocomplete output.


includes/, line 378
Provide completion output for shells.


function drush_complete_get($type, $command = NULL) {
  if (empty($command)) {
    // Retrieve global items from a non-command specific cache, or rebuild cache
    // if needed.
    $cache = drush_cache_get(drush_complete_cache_cid($type), 'complete');
    if (isset($cache->data)) {
      return $cache->data;
    $complete = drush_complete_rebuild();
    return $complete[$type];
  // Retrieve items from a command specific cache.
  $cache = drush_cache_get(drush_complete_cache_cid($type, $command), 'complete');
  if (isset($cache->data)) {
    return $cache->data;
  // Build argument cache - built only on demand.
  if ($type == 'arguments') {
    return drush_complete_rebuild_arguments($command);
  // Rebuild cache of general command specific items.
  $complete = drush_complete_rebuild();
  if (!empty($complete['commands'][$command][$type])) {
    return $complete['commands'][$command][$type];
  return array();