From 8367ab312037c40986d43a4e2199f4402c11a780 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 18 Oct 2016 15:01:44 +0100 Subject: [PATCH] Add ZSH_NVM_NO_LOAD option If ZSH_NVM_NO_LOAD is set to true then zsh-nvm won't actually do anything after setting up environment variables and functions. This is usefull for unit tests and debugging. --- zsh-nvm.plugin.zsh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index ad10b05..e9ce389 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -144,12 +144,17 @@ _zsh_nvm_revert() { fi } -# Install nvm if it isn't already installed -[[ ! -f "$NVM_DIR/nvm.sh" ]] && _zsh_nvm_install +# Don't init anything if this is true (debug/testing only) +if [[ "$ZSH_NVM_NO_LOAD" != true ]]; then -# If nvm is installed -if [[ -f "$NVM_DIR/nvm.sh" ]]; then + # Install nvm if it isn't already installed + [[ ! -f "$NVM_DIR/nvm.sh" ]] && _zsh_nvm_install + + # If nvm is installed + if [[ -f "$NVM_DIR/nvm.sh" ]]; then + + # Load it + [[ "$NVM_LAZY_LOAD" == true ]] && _zsh_nvm_lazy_load || _zsh_nvm_load + fi - # Load it - [[ "$NVM_LAZY_LOAD" == true ]] && _zsh_nvm_lazy_load || _zsh_nvm_load fi