mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-12-13 08:34:19 +00:00
Merge d2b10b94de into 3497474fef
This commit is contained in:
11
nvm.sh
11
nvm.sh
@@ -2684,6 +2684,17 @@ nvm() {
|
||||
unset NVM_BIN
|
||||
;;
|
||||
"use" )
|
||||
# If version not available, install it first, then use it
|
||||
if [ -n "$1" ] && [ "$1" != "--silent" ] && \
|
||||
! nvm ls $1 &>/dev/null ; then
|
||||
args=("$@") # Preserve positional parameters
|
||||
|
||||
nvm install "$@"
|
||||
[ $? -ne 0 ] && return 127 # Return immediately if install fails
|
||||
|
||||
set "${args[@]}" # Restore positional parameters
|
||||
fi
|
||||
|
||||
local PROVIDED_VERSION
|
||||
local NVM_USE_SILENT
|
||||
NVM_USE_SILENT=0
|
||||
|
||||
Reference in New Issue
Block a user