Wrap nvm install to add support for rc/nightly

This commit is contained in:
Luke Childs 2017-05-29 17:26:54 +07:00
parent 7577d37b7e
commit 3d6c5606b2

View File

@ -61,6 +61,9 @@ _zsh_nvm_load() {
_zsh_nvm_nvm "$@" _zsh_nvm_nvm "$@"
export NVM_AUTO_USE_ACTIVE=false export NVM_AUTO_USE_ACTIVE=false
;; ;;
'install')
_zsh_nvm_install_wrapper "$@"
;;
*) *)
_zsh_nvm_nvm "$@" _zsh_nvm_nvm "$@"
;; ;;
@ -172,6 +175,20 @@ _zsh_nvm_auto_use() {
fi fi
} }
_zsh_nvm_install_wrapper() {
case $2 in
'rc')
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/rc/ nvm install node
;;
'nightly')
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm install node
;;
*)
_zsh_nvm_nvm "$@"
;;
esac
}
# Don't init anything if this is true (debug/testing only) # Don't init anything if this is true (debug/testing only)
if [[ "$ZSH_NVM_NO_LOAD" != true ]]; then if [[ "$ZSH_NVM_NO_LOAD" != true ]]; then