aboutsummaryrefslogtreecommitdiff
path: root/network/iojs/npm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'network/iojs/npm.sh')
-rw-r--r--network/iojs/npm.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/network/iojs/npm.sh b/network/iojs/npm.sh
index 3c7a3590d80f7..c0a293c917c64 100644
--- a/network/iojs/npm.sh
+++ b/network/iojs/npm.sh
@@ -7,17 +7,21 @@
# Or, maybe: npm 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
_npm_completion () {
+ local words cword
+ if type _get_comp_words_by_ref &>/dev/null; then
+ _get_comp_words_by_ref -n = -n @ -w words -i cword
+ else
+ cword="$COMP_CWORD"
+ words=("${COMP_WORDS[@]}")
+ fi
+
local si="$IFS"
- IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
+ IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
- npm completion -- "${COMP_WORDS[@]}" \
+ npm completion -- "${words[@]}" \
2>/dev/null)) || return $?
IFS="$si"
}
@@ -52,3 +56,4 @@ elif type compctl &>/dev/null; then
compctl -K _npm_completion npm
fi
###-end-npm-completion-###
+