Browse Source

Check if we have any cached modules before reccomending them

pull/2/head
Luke Childs 8 years ago
parent
commit
86fe4fdae3
  1. 11
      zsh-better-npm-completion.plugin.zsh

11
zsh-better-npm-completion.plugin.zsh

@ -6,6 +6,10 @@ _zbnc_no_of_npm_args() {
echo "$#words" echo "$#words"
} }
_zbnc_list_cached_modules() {
ls ~/.npm
}
_zbnc_recursively_look_for() { _zbnc_recursively_look_for() {
local filename="$1" local filename="$1"
local dir=$PWD local dir=$PWD
@ -31,8 +35,11 @@ _zbnc_npm_install_completion() {
# Only run on `npm install ?` # Only run on `npm install ?`
[[ ! "$(_zbnc_no_of_npm_args)" = "3" ]] && return [[ ! "$(_zbnc_no_of_npm_args)" = "3" ]] && return
# Reccomend cached modules # Return if we don't have any cahced modules
_values $(ls ~/.npm) [[ "$(_zbnc_list_cached_modules)" = "" ]] && return
# If we do, reccomend them
_values $(_zbnc_list_cached_modules)
# Make sure we don't run default completion # Make sure we don't run default completion
custom_completion=true custom_completion=true

Loading…
Cancel
Save