[feature] Add `run` command
`run` command runs given node version without modyfing global state: [maciej@PC07 nvm (run)]$ node --version v0.4.12 [maciej@PC07 nvm (run)]$ nvm run 0.4.12 Running node v0.4.12 > process.version 'v0.4.12' > [maciej@PC07 nvm (run)]$ nvm run 0.5.9 Running node v0.5.9 > process.version 'v0.5.9' > [maciej@PC07 nvm (run)]$ node --version v0.4.12master
parent
4692f496da
commit
09483f422e
14
nvm.sh
14
nvm.sh
|
@ -200,6 +200,20 @@ nvm()
|
|||
export NVM_BIN="$NVM_DIR/$VERSION/bin"
|
||||
echo "Now using node $VERSION"
|
||||
;;
|
||||
"run" )
|
||||
# run given version of node
|
||||
if [ $# -ne 2 ]; then
|
||||
nvm help
|
||||
return
|
||||
fi
|
||||
VERSION=`nvm_version $2`
|
||||
if [ ! -d $NVM_DIR/$VERSION ]; then
|
||||
echo "$VERSION version is not installed yet"
|
||||
return;
|
||||
fi
|
||||
echo "Running node $VERSION"
|
||||
$NVM_DIR/$VERSION/bin/node
|
||||
;;
|
||||
"ls" | "list" )
|
||||
if [ $# -ne 1 ]; then
|
||||
nvm_version $2
|
||||
|
|
Loading…
Reference in New Issue