Compare commits

...

4 Commits

Author SHA1 Message Date
Jahir Raihan Joy
b6f04623c9
Merge 6375e4ed79dc584a8174e5816d68a1c31b6d9b27 into d5e2c92a254cc10e95cd960a47515bec2d5c5e81 2024-08-20 22:22:09 +05:45
Jordan Harband
d5e2c92a25
[Fix] nvm_has_colors: avoid an aliased tput
Fixes #3413
2024-08-20 09:23:45 -07:00
Jordan Harband
81f18bc445
[patch] install.sh: fix node capitalization 2024-08-09 13:46:16 +12:00
Jahir Raihan Joy
6375e4ed79 converted tree path to canonical form for case-insensitive comp 2024-05-09 16:24:33 +06:00
2 changed files with 12 additions and 4 deletions

View File

@ -358,7 +358,7 @@ nvm_check_global_modules() {
command printf %s\\n "$NPM_GLOBAL_MODULES" command printf %s\\n "$NPM_GLOBAL_MODULES"
nvm_echo '=> If you wish to uninstall them at a later point (or re-install them under your' nvm_echo '=> If you wish to uninstall them at a later point (or re-install them under your'
# shellcheck disable=SC2016 # shellcheck disable=SC2016
nvm_echo '=> `nvm` Nodes), you can remove them from the system Node as follows:' nvm_echo '=> `nvm` node installs), you can remove them from the system Node as follows:'
nvm_echo nvm_echo
nvm_echo ' $ nvm use system' nvm_echo ' $ nvm use system'
nvm_echo ' $ npm uninstall -g a_module' nvm_echo ' $ npm uninstall -g a_module'

14
nvm.sh
View File

@ -81,7 +81,7 @@ nvm_command_info() {
nvm_has_colors() { nvm_has_colors() {
local NVM_NUM_COLORS local NVM_NUM_COLORS
if nvm_has tput; then if nvm_has tput; then
NVM_NUM_COLORS="$(tput -T "${TERM:-vt100}" colors)" NVM_NUM_COLORS="$(command tput -T "${TERM:-vt100}" colors)"
fi fi
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ] [ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
} }
@ -434,6 +434,7 @@ else
fi fi
unset NVM_SCRIPT_SOURCE 2>/dev/null unset NVM_SCRIPT_SOURCE 2>/dev/null
nvm_tree_contains_path() { nvm_tree_contains_path() {
local tree local tree
tree="${1-}" tree="${1-}"
@ -449,14 +450,21 @@ nvm_tree_contains_path() {
previous_pathdir="${node_path}" previous_pathdir="${node_path}"
local pathdir local pathdir
pathdir=$(dirname "${previous_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}" != '/' ] && while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do [ "${pathdir}" != "${tree_canonical}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
previous_pathdir="${pathdir}" previous_pathdir="${pathdir}"
pathdir=$(dirname "${previous_pathdir}") pathdir=$(dirname "${previous_pathdir}")
done done
[ "${pathdir}" = "${tree}" ]
[ "${pathdir}" = "${tree_canonical}" ]
} }
nvm_find_project_dir() { nvm_find_project_dir() {
local path_ local path_
path_="${PWD}" path_="${PWD}"