-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_drush
More file actions
29 lines (23 loc) · 1.04 KB
/
_drush
File metadata and controls
29 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#compdef drush
#autoload
autoload bashcompinit
bashcompinit
# Completion function, uses the "drush complete" command to retrieve
# completions for a specific command line COMP_WORDS.
_drush_completion() {
# There's a bug in the zsh implementation of bash complete which causes
# COMP_WORDS to be wrong when we're tab completing a command that ends in a
# space. Instead of including an empty last entry it finishes with the last
# key word. This is a work around to fix that issue.
COMP_WORDS=( $COMP_LINE'' )
# Set IFS to newline (locally), since we only use newline separators, and
# need to retain spaces (or not) after completions.
local IFS=$'\n'
COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}") )
}
# Register our completion function. We include common short aliases for Drush.
complete -o nospace -F _drush_completion d dr drush drush5 drush6 drush6 drush.php
## Register another completion function for every alias to drush.
for a in $(drush sa); do
complete -o nospace -F _drush_completion $a > /dev/null
done