[shellcheck] remove duplicate function

Jordan Harband 2022-12-22 13:00:12 -08:00
parent 4c4b0d64ed
commit abe5e30a9d
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 4 additions and 12 deletions

16
nvm.sh
View File

@ -373,6 +373,7 @@ if [ -z "${NVM_DIR-}" ]; then
# shellcheck disable=SC2169,SC3054 # shellcheck disable=SC2169,SC3054
NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}" NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}"
fi fi
# shellcheck disable=SC2086
NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" >/dev/null && \pwd)" NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" >/dev/null && \pwd)"
export NVM_DIR export NVM_DIR
else else
@ -693,6 +694,7 @@ ${NVM_LS_REMOTE_POST_MERGED_OUTPUT}" | nvm_grep -v "N/A" | command sed '/^ *$/d'
fi fi
# the `sed` is to remove trailing whitespaces (see "weird behavior" ~25 lines up) # the `sed` is to remove trailing whitespaces (see "weird behavior" ~25 lines up)
nvm_echo "${VERSIONS}" | command sed 's/ *$//g' nvm_echo "${VERSIONS}" | command sed 's/ *$//g'
# shellcheck disable=SC2317
return $NVM_LS_REMOTE_EXIT_CODE || $NVM_LS_REMOTE_IOJS_EXIT_CODE return $NVM_LS_REMOTE_EXIT_CODE || $NVM_LS_REMOTE_IOJS_EXIT_CODE
} }
@ -886,18 +888,6 @@ nvm_wrap_with_color_code() {
fi fi
} }
nvm_wrap_with_color_code() {
local CODE
CODE="$(nvm_print_color_code "${1}" 2>/dev/null ||:)"
local TEXT
TEXT="${2-}"
if nvm_has_colors && [ -n "${CODE}" ]; then
nvm_echo_with_colors "\033[${CODE}${TEXT}\033[0m"
else
nvm_echo "${TEXT}"
fi
}
nvm_print_color_code() { nvm_print_color_code() {
case "${1-}" in case "${1-}" in
'0') return 0 ;; '0') return 0 ;;
@ -3801,6 +3791,7 @@ nvm() {
nvm_ensure_version_installed "${provided_version}" nvm_ensure_version_installed "${provided_version}"
EXIT_CODE=$? EXIT_CODE=$?
if [ "${EXIT_CODE}" != "0" ]; then if [ "${EXIT_CODE}" != "0" ]; then
# shellcheck disable=SC2086
return $EXIT_CODE return $EXIT_CODE
fi fi
@ -3957,6 +3948,7 @@ nvm() {
nvm_ensure_version_installed "${provided_version}" nvm_ensure_version_installed "${provided_version}"
EXIT_CODE=$? EXIT_CODE=$?
if [ "${EXIT_CODE}" != "0" ]; then if [ "${EXIT_CODE}" != "0" ]; then
# shellcheck disable=SC2086
return $EXIT_CODE return $EXIT_CODE
fi fi
local NVM_VERSION_DIR local NVM_VERSION_DIR