136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
npm: only load completion if npm exists
Diff
1diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
2index ec595e74d9e81f8e65105af6772014a3e9784464..480e92a91ba9a1a5f93d95acd36576f496de665a 100644
3--- a/plugins/npm/npm.plugin.zsh
4+++ b/plugins/npm/npm.plugin.zsh
5@@ -1,8 +1,10 @@
6-__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
7+(( $+commands[npm] )) && {
8+ __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
9
10-if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
11- npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
12-fi
13+ if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
14+ npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
15+ fi
16+}
17
18 source $__NPM_COMPLETION_FILE
19