]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/bower/_bower
initial
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / bower / _bower
1
2
3 # Credits to npm's awesome completion utility.
4 #
5 # Bower completion script, based on npm completion script.
6
7 ###-begin-bower-completion-###
8 #
9 # Installation: bower completion >> ~/.bashrc  (or ~/.zshrc)
10 # Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower
11 #
12
13 COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
14 COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
15 export COMP_WORDBREAKS
16
17 if type complete &>/dev/null; then
18   _bower_completion () {
19     local si="$IFS"
20     IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
21                            COMP_LINE="$COMP_LINE" \
22                            COMP_POINT="$COMP_POINT" \
23                            bower completion -- "${COMP_WORDS[@]}" \
24                            2>/dev/null)) || return $?
25     IFS="$si"
26   }
27   complete -F _bower_completion bower
28 elif type compdef &>/dev/null; then
29   _bower_completion() {
30     si=$IFS
31     compadd -- $(COMP_CWORD=$((CURRENT-1)) \
32                  COMP_LINE=$BUFFER \
33                  COMP_POINT=0 \
34                  bower completion -- "${words[@]}" \
35                  2>/dev/null)
36     IFS=$si
37   }
38   compdef _bower_completion bower
39 elif type compctl &>/dev/null; then
40   _bower_completion () {
41     local cword line point words si
42     read -Ac words
43     read -cn cword
44     let cword-=1
45     read -l line
46     read -ln point
47     si="$IFS"
48     IFS=$'\n' reply=($(COMP_CWORD="$cword" \
49                        COMP_LINE="$line" \
50                        COMP_POINT="$point" \
51                        bower completion -- "${words[@]}" \
52                        2>/dev/null)) || return $?
53     IFS="$si"
54   }
55   compctl -K _bower_completion bower
56 fi
57 ###-end-bower-completion-###
58