Browse Source

Put a star by the active version in "nvm list" and don't allow "nvm use" to set a version that isn't installed.

install_use_nvmrc
Tim Caswell 15 years ago
parent
commit
53e64fc3b5
  1. 20
      nvm.sh

20
nvm.sh

@ -78,6 +78,10 @@ nvm()
nvm help
return;
fi
if [ ! -d $NVM_DIR/$2 ]; then
echo "$2 version is not installed yet"
return;
fi
if [[ $PATH == *$NVM_DIR/*/bin* ]]; then
PATH=${PATH%$NVM_DIR/*/bin*}$NVM_DIR/$2/bin${PATH#*$NVM_DIR/*/bin}
else
@ -91,8 +95,20 @@ nvm()
nvm help
return;
fi
# TODO: put a star by the current active one if possible
ls "$NVM_DIR" | grep -v src | grep -v nvm.sh | grep -v README.markdown
if [ -d $NVM_DIR/HEAD ]; then
if [[ $PATH == *$NVM_DIR/HEAD/bin* ]]; then
echo "HEAD *"
else
echo "HEAD"
fi
fi
for f in $NVM_DIR/v*; do
if [[ $PATH == *$f/bin* ]]; then
echo "v${f##*v} *"
else
echo "v${f##*v}"
fi
done
;;
* )
nvm help

Loading…
Cancel
Save