mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-16 18:43:43 +00:00
Compare commits
3 Commits
c59ccfff29
...
12c5000257
Author | SHA1 | Date | |
---|---|---|---|
![]() |
12c5000257 | ||
![]() |
ff1257e8e3 | ||
![]() |
6375e4ed79 |
18
nvm.sh
18
nvm.sh
@ -83,7 +83,7 @@ nvm_has_colors() {
|
||||
if nvm_has tput; then
|
||||
NVM_NUM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
|
||||
fi
|
||||
[ "${NVM_NUM_COLORS:--1}" -ge 8 ]
|
||||
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
|
||||
}
|
||||
|
||||
nvm_curl_libz_support() {
|
||||
@ -434,6 +434,7 @@ else
|
||||
fi
|
||||
unset NVM_SCRIPT_SOURCE 2>/dev/null
|
||||
|
||||
|
||||
nvm_tree_contains_path() {
|
||||
local tree
|
||||
tree="${1-}"
|
||||
@ -449,14 +450,21 @@ nvm_tree_contains_path() {
|
||||
previous_pathdir="${node_path}"
|
||||
local pathdir
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
|
||||
# Convert tree path to canonical form for case-insensitive comparison
|
||||
local tree_canonical
|
||||
tree_canonical=$(cd "${tree}" && pwd -P)
|
||||
|
||||
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
|
||||
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
[ "${pathdir}" != "${tree_canonical}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
previous_pathdir="${pathdir}"
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
done
|
||||
[ "${pathdir}" = "${tree}" ]
|
||||
|
||||
[ "${pathdir}" = "${tree_canonical}" ]
|
||||
}
|
||||
|
||||
|
||||
nvm_find_project_dir() {
|
||||
local path_
|
||||
path_="${PWD}"
|
||||
@ -1094,7 +1102,7 @@ nvm_print_formatted_alias() {
|
||||
fi
|
||||
local ARROW
|
||||
ARROW='->'
|
||||
if [ -z "${NVM_NO_COLORS}" ] && nvm_has_colors; then
|
||||
if nvm_has_colors; then
|
||||
ARROW='\033[0;90m->\033[0m'
|
||||
if [ "_${DEFAULT}" = '_true' ]; then
|
||||
NEWLINE=" \033[${DEFAULT_COLOR}(default)\033[0m\n"
|
||||
@ -1832,7 +1840,7 @@ nvm_print_versions() {
|
||||
DEFAULT_COLOR=$(nvm_get_colors 5)
|
||||
LTS_COLOR=$(nvm_get_colors 6)
|
||||
|
||||
if [ -z "${NVM_NO_COLORS-}" ] && nvm_has_colors; then
|
||||
if nvm_has_colors; then
|
||||
NVM_HAS_COLORS=1
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user