`nvm alias`: colorize output when creating aliases.
parent
fc82742a8b
commit
bc3d028152
13
nvm.sh
13
nvm.sh
|
@ -423,10 +423,13 @@ nvm_print_formatted_alias() {
|
||||||
local DEST
|
local DEST
|
||||||
DEST="${2-}"
|
DEST="${2-}"
|
||||||
local VERSION
|
local VERSION
|
||||||
|
VERSION="${3-}"
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
VERSION="$(nvm_version "$DEST" || return 0)"
|
||||||
|
fi
|
||||||
local VERSION_FORMAT
|
local VERSION_FORMAT
|
||||||
local ALIAS_FORMAT
|
local ALIAS_FORMAT
|
||||||
local DEST_FORMAT
|
local DEST_FORMAT
|
||||||
VERSION="$(nvm_version "$DEST" || return 0)"
|
|
||||||
ALIAS_FORMAT='%s'
|
ALIAS_FORMAT='%s'
|
||||||
DEST_FORMAT='%s'
|
DEST_FORMAT='%s'
|
||||||
VERSION_FORMAT='%s'
|
VERSION_FORMAT='%s'
|
||||||
|
@ -2388,9 +2391,9 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
|
||||||
local NVM_ALIAS_DIR
|
local NVM_ALIAS_DIR
|
||||||
NVM_ALIAS_DIR="$(nvm_alias_path)"
|
NVM_ALIAS_DIR="$(nvm_alias_path)"
|
||||||
command mkdir -p "$NVM_ALIAS_DIR"
|
command mkdir -p "$NVM_ALIAS_DIR"
|
||||||
if [ $# -le 2 ]; then
|
|
||||||
local NVM_CURRENT
|
local NVM_CURRENT
|
||||||
NVM_CURRENT="$(nvm_ls_current)"
|
NVM_CURRENT="$(nvm_ls_current)"
|
||||||
|
if [ $# -le 2 ]; then
|
||||||
local ALIAS_PATH
|
local ALIAS_PATH
|
||||||
for ALIAS_PATH in "$NVM_ALIAS_DIR/${2-}"*; do
|
for ALIAS_PATH in "$NVM_ALIAS_DIR/${2-}"*; do
|
||||||
NVM_CURRENT="${NVM_CURRENT}" nvm_print_alias_path "$NVM_ALIAS_DIR" "$ALIAS_PATH"
|
NVM_CURRENT="${NVM_CURRENT}" nvm_print_alias_path "$NVM_ALIAS_DIR" "$ALIAS_PATH"
|
||||||
|
@ -2417,11 +2420,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
|
||||||
nvm_err "! WARNING: Version '${3-}' does not exist."
|
nvm_err "! WARNING: Version '${3-}' does not exist."
|
||||||
fi
|
fi
|
||||||
nvm_make_alias "${2-}" "${3-}"
|
nvm_make_alias "${2-}" "${3-}"
|
||||||
if [ "_$3" = "_$VERSION" ]; then
|
NVM_CURRENT="${NVM_CURRENT-}" DEFAULT=false nvm_print_formatted_alias "${2-}" "${3-}" "$VERSION"
|
||||||
nvm_echo "${2-} -> ${3-}"
|
|
||||||
else
|
|
||||||
nvm_echo "${2-} -> ${3-} (-> $VERSION)"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
"unalias" )
|
"unalias" )
|
||||||
local NVM_ALIAS_DIR
|
local NVM_ALIAS_DIR
|
||||||
|
|
Loading…
Reference in New Issue