|
|
@ -30,6 +30,27 @@ _zsh_nvm_install() { |
|
|
|
$(cd "$NVM_DIR" && git checkout --quiet "$(_zsh_nvm_latest_release_tag)") |
|
|
|
} |
|
|
|
|
|
|
|
_zsh_nvm_load() { |
|
|
|
|
|
|
|
# Source nvm |
|
|
|
source "$NVM_DIR/nvm.sh" |
|
|
|
|
|
|
|
# Rename main nvm function |
|
|
|
_zsh_nvm_rename_function nvm _zsh_nvm_nvm |
|
|
|
|
|
|
|
# Wrap nvm in our own function |
|
|
|
nvm() { |
|
|
|
case $1 in |
|
|
|
'upgrade') |
|
|
|
_zsh_nvm_upgrade |
|
|
|
;; |
|
|
|
*) |
|
|
|
_zsh_nvm_nvm "$@" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
nvm_update() { |
|
|
|
echo 'Deprecated, please use `nvm upgrade`' |
|
|
|
} |
|
|
@ -43,31 +64,12 @@ _zsh_nvm_upgrade() { |
|
|
|
else |
|
|
|
echo "Updating to $latest_version..." |
|
|
|
$(cd "$NVM_DIR" && git fetch --quiet && git checkout "$latest_version") |
|
|
|
source "$NVM_DIR/nvm.sh" |
|
|
|
_zsh_nvm_load |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
# 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 |
|
|
|
|
|
|
|
# Source nvm |
|
|
|
source "$NVM_DIR/nvm.sh" |
|
|
|
|
|
|
|
# Rename main nvm function |
|
|
|
_zsh_nvm_rename_function nvm _zsh_nvm_nvm |
|
|
|
|
|
|
|
# Wrap nvm in our own function |
|
|
|
nvm() { |
|
|
|
case $1 in |
|
|
|
'upgrade') |
|
|
|
_zsh_nvm_upgrade |
|
|
|
;; |
|
|
|
*) |
|
|
|
_zsh_nvm_nvm "$@" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
fi |
|
|
|
# If nvm is installed, load it |
|
|
|
[[ -f "$NVM_DIR/nvm.sh" ]] && _zsh_nvm_load |
|
|
|