Compare commits

...

4 Commits

Author SHA1 Message Date
Chris Seitz
b3a865aef4
Merge 387d92cd4d5b452175dd2df837f24adf25789331 into 4beab63631764fc381a0e56273faf8d43b8f9509 2024-08-07 09:40:31 +00:00
Jordan Harband
4beab63631
[Fix] declare an unbound variable
Fixes #3402
2024-08-07 17:38:37 +12:00
Chris Seitz
387d92cd4d
Merge pull request #1 from cseitz-forks/cseitz-nvm-no-help-1
Added NVM_NO_HELP flag to nvm.sh
2023-06-06 13:34:03 -04:00
Chris Seitz
85e1d29fa8
Added NVM_NO_HELP flag to nvm.sh
This allows you to prevent NVM from intercepting help calls.
2023-06-06 13:31:41 -04:00

15
nvm.sh
View File

@ -503,9 +503,9 @@ $(nvm_wrap_with_color_code 'y' "${warn_text}")"
} }
nvm_process_nvmrc() { nvm_process_nvmrc() {
local NVMRC_PATH="$1" local NVMRC_PATH
NVMRC_PATH="$1"
local lines local lines
local unpaired_line
lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$') lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$')
@ -515,8 +515,12 @@ nvm_process_nvmrc() {
fi fi
# Initialize key-value storage # Initialize key-value storage
local keys='' local keys
local values='' keys=''
local values
values=''
local unpaired_line
unpaired_line=''
while IFS= read -r line; do while IFS= read -r line; do
if [ -z "${line}" ]; then if [ -z "${line}" ]; then
@ -2995,6 +2999,9 @@ nvm() {
--) break ;; --) break ;;
'-h'|'help'|'--help') '-h'|'help'|'--help')
NVM_NO_COLORS="" NVM_NO_COLORS=""
if [[ "$NVM_NO_HELP" -eq 1 ]]; then
break;
fi
for j in "$@"; do for j in "$@"; do
if [ "${j}" = '--no-colors' ]; then if [ "${j}" = '--no-colors' ]; then
NVM_NO_COLORS="${j}" NVM_NO_COLORS="${j}"