Set MANPATH on nvm use and deactivate

master
Carter Thaxton 2010-12-11 20:19:23 -08:00
parent 077a661696
commit d3b5853454
1 changed files with 12 additions and 0 deletions

12
nvm.sh
View File

@ -59,6 +59,12 @@ nvm()
else
echo "Could not find $NVM_DIR/*/bin in \$PATH"
fi
if [[ $MANPATH == *$NVM_DIR/*/share/man* ]]; then
export MANPATH=${MANPATH%$NVM_DIR/*/share/man*}${MANPATH#*$NVM_DIR/*/share/man:}
echo "$NVM_DIR/*/share/man removed from \$MANPATH"
else
echo "Could not find $NVM_DIR/*/share/man in \$MANPATH"
fi
;;
"use" )
if [ $# -ne 2 ]; then
@ -74,7 +80,13 @@ nvm()
else
PATH="$NVM_DIR/$2/bin:$PATH"
fi
if [[ $MANPATH == *$NVM_DIR/*/share/man* ]]; then
MANPATH=${MANPATH%$NVM_DIR/*/share/man*}$NVM_DIR/$2/share/man${MANPATH#*$NVM_DIR/*/share/man}
else
MANPATH="$NVM_DIR/$2/share/man:$MANPATH"
fi
export PATH
export MANPATH
export NVM_PATH="$NVM_DIR/$2/lib/node"
export NVM_BIN="$NVM_DIR/$2/bin"
echo "Now using node $2"