Ensure that a system has `manpath` before invoking it.

Closes #531, fixes #557.
master
Jordan Harband 2014-11-02 13:54:54 -08:00
parent 4b6075e29b
commit d09b84de3c
1 changed files with 9 additions and 7 deletions

16
nvm.sh
View File

@ -836,20 +836,22 @@ nvm() {
PATH=`nvm_strip_path "$PATH" "/bin"` PATH=`nvm_strip_path "$PATH" "/bin"`
# Prepend current version # Prepend current version
PATH=`nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin"` PATH=`nvm_prepend_path "$PATH" "$NVM_VERSION_DIR/bin"`
if [ -z "$MANPATH" ]; then if nvm_has manpath; then
MANPATH=$(manpath) if [ -z "$MANPATH" ]; then
MANPATH=$(manpath)
fi
# Strip other version from MANPATH
MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
# Prepend current version
MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"`
export MANPATH
fi fi
# Strip other version from MANPATH
MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
# Prepend current version
MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"`
# Strip other version from NODE_PATH # Strip other version from NODE_PATH
NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"` NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
# Prepend current version # Prepend current version
NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_VERSION_DIR/lib/node_modules"` NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_VERSION_DIR/lib/node_modules"`
export PATH export PATH
hash -r hash -r
export MANPATH
export NODE_PATH export NODE_PATH
export NVM_PATH="$NVM_VERSION_DIR/lib/node" export NVM_PATH="$NVM_VERSION_DIR/lib/node"
export NVM_BIN="$NVM_VERSION_DIR/bin" export NVM_BIN="$NVM_VERSION_DIR/bin"