function drush_complete_rebuild

8.0.x drush_complete_rebuild()
6.x drush_complete_rebuild()
7.x drush_complete_rebuild()
5.x drush_complete_rebuild()
master drush_complete_rebuild()

Rebuild and cache completions for everything except command arguments.

Return value

array Structured array of completion types, commands and candidate completions.

1 call to drush_complete_rebuild()
drush_complete_get in includes/
Retrieves from cache, or generates a listing of completion candidates of a specific type (and optionally, command).


includes/, line 412
Provide completion output for shells.


function drush_complete_rebuild() {
  $complete = array();
  // Bootstrap to the site level (if possible) - commands may need to check
  // the bootstrap level, and perhaps bootstrap higher in extraordinary cases.
  $commands = drush_get_commands();
  foreach ($commands as $command_name => $command) {
    // Add command options and suboptions.
    $options = array_keys($command['options']);
    foreach ($command['sub-options'] as $option => $sub_options) {
      $options = array_merge($options, array_keys($sub_options));
    $complete['commands'][$command_name]['options'] = $options;
  // We treat shell aliases as commands for the purposes of completion.
  $complete['command-names'] = array_merge(array_keys($commands), array_keys(drush_get_context('shell-aliases', array())));
  $site_aliases = _drush_sitealias_all_list();
  // TODO: Figure out where this dummy @0 alias is introduced.
  $complete['site-aliases'] = array_keys($site_aliases);
  $complete['options'] = array_keys(drush_get_global_options());

  // We add a space following all completes. Eventually there may be some
  // items (e.g. options that we know need values) where we don't add a space.
  array_walk_recursive($complete, 'drush_complete_trailing_space');
  return $complete;