diff options
author | Adam Krebs <amk528@cs.nyu.edu> | 2013-04-01 00:26:39 -0400 |
---|---|---|
committer | Adam Krebs <amk528@cs.nyu.edu> | 2013-04-01 00:26:39 -0400 |
commit | b7608bf32de06a546ae509f872bba44a46e10f0a (patch) | |
tree | b10b0a7bd33d50bd2e8cde87d3fa2bdf2be5cfff /plugins/bower | |
parent | 0ab0e67ecfc52b4779b700149a9c51feeb05318e (diff) | |
download | zsh-b7608bf32de06a546ae509f872bba44a46e10f0a.tar.gz zsh-b7608bf32de06a546ae509f872bba44a46e10f0a.tar.bz2 zsh-b7608bf32de06a546ae509f872bba44a46e10f0a.zip |
add bower autocompletion
Diffstat (limited to 'plugins/bower')
-rw-r--r-- | plugins/bower/_bower | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/bower/_bower b/plugins/bower/_bower new file mode 100644 index 000000000..1b582a55e --- /dev/null +++ b/plugins/bower/_bower @@ -0,0 +1,58 @@ + + +# Credits to npm's. Awesome completion utility. +# +# Bower completion script, based on npm completion script. + +###-begin-bower-completion-### +# +# Installation: bower completion >> ~/.bashrc (or ~/.zshrc) +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/npm +# + +COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} +COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} +export COMP_WORDBREAKS + +if type complete &>/dev/null; then + _bower_completion () { + local si="$IFS" + IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + bower completion -- "${COMP_WORDS[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + complete -F _bower_completion bower +elif type compdef &>/dev/null; then + _bower_completion() { + si=$IFS + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + bower completion -- "${words[@]}" \ + 2>/dev/null) + IFS=$si + } + compdef _bower_completion bower +elif type compctl &>/dev/null; then + _bower_completion () { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + si="$IFS" + IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + bower completion -- "${words[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + compctl -K _bower_completion bower +fi +###-end-bower-completion-### + |