[readme] optimize calling of `nvm version` in zsh
parent
8fd948001e
commit
4893128c61
|
@ -613,7 +613,6 @@ Put this into your `$HOME/.zshrc` to call `nvm use` automatically whenever you e
|
|||
# place this after nvm initialization!
|
||||
autoload -U add-zsh-hook
|
||||
load-nvmrc() {
|
||||
local node_version="$(nvm version)"
|
||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
||||
|
||||
if [ -n "$nvmrc_path" ]; then
|
||||
|
@ -621,10 +620,10 @@ load-nvmrc() {
|
|||
|
||||
if [ "$nvmrc_node_version" = "N/A" ]; then
|
||||
nvm install
|
||||
elif [ "$nvmrc_node_version" != "$node_version" ]; then
|
||||
elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
|
||||
nvm use
|
||||
fi
|
||||
elif [ "$node_version" != "$(nvm version default)" ]; then
|
||||
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
|
||||
echo "Reverting to nvm default version"
|
||||
nvm use default
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue