npm: only load completion if npm exists

This commit is contained in:
Marc Cornellà 2016-08-23 09:31:29 +02:00
Родитель 3b8d0ad9d0
Коммит 136a83433a
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -1,8 +1,10 @@
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
(( $+commands[npm] )) && {
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
fi
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
fi
}
source $__NPM_COMPLETION_FILE