Don't list uninstalled implicit aliases

master
Jordan Harband 2014-10-10 23:25:47 -04:00
parent 8f76b35370
commit e99645f402
1 changed files with 5 additions and 3 deletions

8
nvm.sh
View File

@ -891,7 +891,7 @@ nvm() {
local DEST local DEST
for ALIAS_PATH in "$NVM_DIR"/alias/"$2"*; do for ALIAS_PATH in "$NVM_DIR"/alias/"$2"*; do
ALIAS="$(basename "$ALIAS_PATH")" ALIAS="$(basename "$ALIAS_PATH")"
DEST="$(nvm_alias "$ALIAS" 2&>1 > /dev/null)" DEST="$(nvm_alias "$ALIAS" 2> /dev/null)"
if [ -n "$DEST" ]; then if [ -n "$DEST" ]; then
VERSION="$(nvm_version "$DEST")" VERSION="$(nvm_version "$DEST")"
if [ "_$DEST" = "_$VERSION" ]; then if [ "_$DEST" = "_$VERSION" ]; then
@ -906,8 +906,10 @@ nvm() {
if [ ! -f "$NVM_DIR/alias/$ALIAS" ]; then if [ ! -f "$NVM_DIR/alias/$ALIAS" ]; then
if [ $# -lt 2 ] || [ "~$ALIAS" = "~$2" ]; then if [ $# -lt 2 ] || [ "~$ALIAS" = "~$2" ]; then
DEST="$(nvm_print_implicit_alias local "$ALIAS")" DEST="$(nvm_print_implicit_alias local "$ALIAS")"
VERSION="$(nvm_version "$DEST")" if [ "_$DEST" != "_" ]; then
echo "$ALIAS -> $DEST (-> $VERSION) (default)" VERSION="$(nvm_version "$DEST")"
echo "$ALIAS -> $DEST (-> $VERSION) (default)"
fi
fi fi
fi fi
done done