From d0c6b87b2e034feb085e38c31ace8b382980c288 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 30 Sep 2014 00:24:02 -0700 Subject: [PATCH] Use `nvm_alias` in `nvm alias` --- nvm.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nvm.sh b/nvm.sh index b0ed78a..3327050 100644 --- a/nvm.sh +++ b/nvm.sh @@ -890,14 +890,15 @@ nvm() { mkdir -p "$NVM_DIR/alias" if [ $# -le 2 ]; then local DEST - for ALIAS in "$NVM_DIR"/alias/"$2"*; do - if [ -e "$ALIAS" ]; then - DEST="$(cat "$ALIAS")" + for ALIAS_PATH in "$NVM_DIR"/alias/"$2"*; do + ALIAS="$(basename "$ALIAS_PATH")" + DEST="$(nvm_alias "$ALIAS" 2>1 /dev/null)" + if [ -n "$DEST" ]; then VERSION="$(nvm_version "$DEST")" if [ "_$DEST" = "_$VERSION" ]; then - echo "$(basename "$ALIAS") -> $DEST" + echo "$ALIAS -> $DEST" else - echo "$(basename "$ALIAS") -> $DEST (-> $VERSION)" + echo "$ALIAS -> $DEST (-> $VERSION)" fi fi done