Skip to content

Commit

Permalink
Fall back to default npm completion for global uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Jan 9, 2017
1 parent 4b85c87 commit 8e1a9ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zsh-better-npm-completion.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ _zbnc_npm_command() {
echo "${words[2]}"
}

_zbnc_npm_command_arg() {
echo "${words[3]}"
}

_zbnc_no_of_npm_args() {
echo "$#words"
}
Expand Down Expand Up @@ -66,6 +70,9 @@ _zbnc_npm_install_completion() {

_zbnc_npm_uninstall_completion() {

# Use default npm completion to recommend global modules
[[ "$(_zbnc_npm_command_arg)" = "-g" ]] || [[ "$(_zbnc_npm_command_arg)" = "--global" ]] && return

# Look for a package.json file
local package_json="$(_zbnc_recursively_look_for package.json)"

Expand Down

0 comments on commit 8e1a9ac

Please sign in to comment.