From b7608bf32de06a546ae509f872bba44a46e10f0a Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 1 Apr 2013 00:26:39 -0400 Subject: [PATCH 1/2] add bower autocompletion --- plugins/bower/_bower | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/bower/_bower 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-### + From f9722174f72f3eb184159e7c77751472cb73384e Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 1 Apr 2013 00:30:35 -0400 Subject: [PATCH 2/2] fix some references from npm --> bower. --- plugins/bower/_bower | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 plugins/bower/_bower diff --git a/plugins/bower/_bower b/plugins/bower/_bower old mode 100644 new mode 100755 index 1b582a55e..ae0ca4a4e --- a/plugins/bower/_bower +++ b/plugins/bower/_bower @@ -1,13 +1,13 @@ -# Credits to npm's. Awesome completion utility. +# 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 +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower # COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}