mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-31 01:45:50 +08:00
nvm alias: explicitly forbid user aliases in subdirs.
This commit is contained in:
8
nvm.sh
8
nvm.sh
@@ -2318,6 +2318,10 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
|
||||
nvm unalias "${2-}"
|
||||
return $?
|
||||
fi
|
||||
if [ "${2#*\/}" != "${2-}" ]; then
|
||||
>&2 echo "Aliases in subdirectories are not supported."
|
||||
return 1
|
||||
fi
|
||||
VERSION="$(nvm_version "${3-}")"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "! WARNING: Version '${3-}' does not exist." >&2
|
||||
@@ -2337,6 +2341,10 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
|
||||
>&2 nvm help
|
||||
return 127
|
||||
fi
|
||||
if [ "${2#*\/}" != "${2-}" ]; then
|
||||
>&2 echo "Aliases in subdirectories are not supported."
|
||||
return 1
|
||||
fi
|
||||
[ ! -f "$NVM_ALIAS_DIR/$2" ] && echo "Alias $2 doesn't exist!" >&2 && return
|
||||
local NVM_ALIAS_ORIGINAL
|
||||
NVM_ALIAS_ORIGINAL="$(nvm_alias "$2")"
|
||||
|
||||
Reference in New Issue
Block a user