Merge pull request #76 from mmalecki/run

[feature] Run command
This commit is contained in:
Tim Caswell
2011-11-14 08:30:06 -08:00
2 changed files with 18 additions and 0 deletions

14
nvm.sh
View File

@@ -188,6 +188,20 @@ nvm()
export NVM_BIN="$NVM_DIR/$VERSION/bin"
echo "Now using node $VERSION"
;;
"run" )
# run given version of node
if [ $# -lt 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 "${@:3}"
;;
"ls" | "list" )
if [ $# -ne 1 ]; then
nvm_version $2