diff options
author | Marc Cornellà <marc.cornella@live.com> | 2016-08-23 09:31:29 +0200 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2016-08-23 09:31:29 +0200 |
commit | 136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa (patch) | |
tree | 73d6beb621a871a15dc8b08c176639e8bfe0179f /plugins/npm | |
parent | 3b8d0ad9d0431bb76235f255458e43b2ab51b13b (diff) | |
download | zsh-136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa.tar.gz zsh-136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa.tar.bz2 zsh-136a83433ad5214eb3d5a0ca3c799be8fc9cb1aa.zip |
npm: only load completion if npm exists
Diffstat (limited to 'plugins/npm')
-rw-r--r-- | plugins/npm/npm.plugin.zsh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index ec595e74d..480e92a91 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -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 |