mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Properly handle nvm_print_implicit_alias splitting in zsh.
Hopefully fixes #546.
This commit is contained in:
		
							
								
								
									
										15
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -412,14 +412,21 @@ nvm_print_implicit_alias() { | |||||||
|  |  | ||||||
|   local LAST_TWO |   local LAST_TWO | ||||||
|   if [ "_$1" = "_local" ]; then |   if [ "_$1" = "_local" ]; then | ||||||
|     LAST_TWO="$(nvm_ls | \grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq)" |     LAST_TWO=$(nvm_ls | \grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq) | ||||||
|   else |   else | ||||||
|     LAST_TWO="$(nvm_ls_remote | \grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq)" |     LAST_TWO=$(nvm_ls_remote | \grep -e '^v' | cut -c2- | cut -d . -f 1,2 | uniq) | ||||||
|   fi |   fi | ||||||
|   local MINOR |   local MINOR | ||||||
|   local STABLE |   local STABLE | ||||||
|   local UNSTABLE |   local UNSTABLE | ||||||
|   local MOD |   local MOD | ||||||
|  |  | ||||||
|  |   local ZHS_HAS_SHWORDSPLIT_UNSET | ||||||
|  |   ZHS_HAS_SHWORDSPLIT_UNSET=1 | ||||||
|  |   if nvm_has "setopt"; then | ||||||
|  |     ZHS_HAS_SHWORDSPLIT_UNSET=$(setopt | \grep shwordsplit > /dev/null ; echo $?) | ||||||
|  |     setopt shwordsplit | ||||||
|  |   fi | ||||||
|   for MINOR in $LAST_TWO; do |   for MINOR in $LAST_TWO; do | ||||||
|     MOD=$(expr "$(nvm_normalize_version "$MINOR")" \/ 1000000 \% 2) |     MOD=$(expr "$(nvm_normalize_version "$MINOR")" \/ 1000000 \% 2) | ||||||
|     if [ $MOD -eq 0 ]; then |     if [ $MOD -eq 0 ]; then | ||||||
| @@ -428,6 +435,10 @@ nvm_print_implicit_alias() { | |||||||
|       UNSTABLE="$MINOR" |       UNSTABLE="$MINOR" | ||||||
|     fi |     fi | ||||||
|   done |   done | ||||||
|  |   if [ $ZHS_HAS_SHWORDSPLIT_UNSET -eq 1 ] && nvm_has "unsetopt"; then | ||||||
|  |     unsetopt shwordsplit | ||||||
|  |   fi | ||||||
|  |  | ||||||
|   if [ "_$2" = "_stable" ]; then |   if [ "_$2" = "_stable" ]; then | ||||||
|     echo $STABLE |     echo $STABLE | ||||||
|   elif [ "_$2" = "_unstable" ]; then |   elif [ "_$2" = "_unstable" ]; then | ||||||
|   | |||||||
| @@ -30,6 +30,11 @@ nvm_ls_remote() { | |||||||
|   echo "v0.6.6" |   echo "v0.6.6" | ||||||
|   echo "v0.7.7" |   echo "v0.7.7" | ||||||
|   echo "v0.9.7" |   echo "v0.9.7" | ||||||
|  |   echo "v0.4.3" | ||||||
|  |   echo "v0.5.4" | ||||||
|  |   echo "v0.6.6" | ||||||
|  |   echo "v0.7.7" | ||||||
|  |   echo "v0.9.7" | ||||||
| } | } | ||||||
|  |  | ||||||
| LATEST_STABLE="$(nvm_print_implicit_alias remote stable)" | LATEST_STABLE="$(nvm_print_implicit_alias remote stable)" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user