function drush_complete_match

8.0.x drush_complete_match($last_word, $values)
6.x drush_complete_match($last_word, $values)
7.x drush_complete_match($last_word, $values)
5.x drush_complete_match($last_word, $values)
master drush_complete_match($last_word, $values)

Retrieves the appropriate list of candidate completions, then filters this list using the last word that we are trying to complete.


string $last_word: The last word in the argument list (i.e. the subject of completion).

array $values: Array of possible completion values to filter.

Return value

array Array of candidate completions that start with the same characters as the last word. If the last word is empty, return all candidates.

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


includes/, line 271
Provide completion output for shells.


function drush_complete_match($last_word, $values) {
  // Using preg_grep appears to be faster that strpos with array_filter/loop.
  return preg_grep('/^' . preg_quote($last_word, '/') . '/', $values);