mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	added -s (install from source) option.
This commit is contained in:
		
							
								
								
									
										20
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -151,7 +151,7 @@ nvm() | ||||
|       echo | ||||
|       echo "Usage:" | ||||
|       echo "    nvm help                    Show this message" | ||||
|       echo "    nvm install <version>       Download and install a <version>" | ||||
|       echo "    nvm install [-s] <version>  Download and install a <version>" | ||||
|       echo "    nvm uninstall <version>     Uninstall a version" | ||||
|       echo "    nvm use <version>           Modify PATH to use <version>" | ||||
|       echo "    nvm run <version> [<args>]  Run <version> with <args> as arguments" | ||||
| @@ -180,6 +180,7 @@ nvm() | ||||
|       local sum | ||||
|       local tarball | ||||
|       local shasum='shasum' | ||||
|       local nobinary | ||||
|  | ||||
|       if [ ! `which curl` ]; then | ||||
|         echo 'NVM Needs curl to proceed.' >&2; | ||||
| @@ -193,10 +194,20 @@ nvm() | ||||
|         nvm help | ||||
|         return | ||||
|       fi | ||||
|       VERSION=`nvm_remote_version $2` | ||||
|  | ||||
|       shift | ||||
|  | ||||
|       nobinary=0 | ||||
|       if [ "$1" = "-s" ]; then | ||||
|         nobinary=1 | ||||
|         shift | ||||
|       fi | ||||
|  | ||||
|       VERSION=`nvm_remote_version $1` | ||||
|       ADDITIONAL_PARAMETERS='' | ||||
|  | ||||
|       shift | ||||
|       shift | ||||
|  | ||||
|       while [ $# -ne 0 ] | ||||
|       do | ||||
|         ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1" | ||||
| @@ -205,6 +216,8 @@ nvm() | ||||
|  | ||||
|       [ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return | ||||
|  | ||||
|       # skip binary install if no binary option specified. | ||||
|       if [ $nobinary -ne 1 ]; then | ||||
|         # shortcut - try the binary if possible. | ||||
|         if [ -n "$os" ]; then | ||||
|           binavail= | ||||
| @@ -236,6 +249,7 @@ nvm() | ||||
|             fi | ||||
|           fi | ||||
|         fi | ||||
|       fi | ||||
|  | ||||
|       echo "Additional options while compiling: $ADDITIONAL_PARAMETERS" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user