If nvm is deactivated, display "none" or "system" instead of the system node version

This commit is contained in:
Jordan Harband
2014-07-14 11:17:26 -07:00
parent 6e02e5a54c
commit 9912f7cc46
2 changed files with 14 additions and 2 deletions

10
nvm.sh
View File

@@ -160,7 +160,15 @@ nvm_binary_available() {
}
nvm_ls_current() {
echo `node -v 2>/dev/null`
local NODE_PATH
NODE_PATH="$(which node)"
if [ $? -ne 0 ]; then
echo 'none'
elif nvm_tree_contains_path "$NVM_DIR" "$NODE_PATH"; then
echo `node -v 2>/dev/null`
else
echo 'system'
fi
}
nvm_ls() {