function drush_complete_match

8.0.x complete.inc drush_complete_match($last_word, $values)
6.x complete.inc drush_complete_match($last_word, $values)
7.x complete.inc drush_complete_match($last_word, $values)
5.x complete.inc drush_complete_match($last_word, $values)
master complete.inc 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.

Parameters

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.

2 calls to drush_complete_match()
drush_complete_match_file in includes/complete.inc
Retrieves the appropriate list of candidate file/directory completions, filtered by the last word that we are trying to complete.
drush_early_complete in includes/complete.inc
Produce autocomplete output.

File

includes/complete.inc, line 275
Provide completion output for shells.

Code

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);
}