Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[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.12
  • Loading branch information...
commit 09483f422e074379908b175af84a50ba4ac00844 1 parent 4692f49
@mmalecki mmalecki authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 nvm.sh
View
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

0 comments on commit 09483f4

Please sign in to comment.
Something went wrong with that request. Please try again.