This commit is contained in:
Jordan Harband 2022-02-09 04:36:34 +05:30 committed by GitHub
commit 984747ea06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

20
nvm.sh
View File

@ -46,7 +46,7 @@ nvm_grep() {
}
nvm_has() {
type "${1-}" >/dev/null 2>&1
command type "${1-}" >/dev/null 2>&1
}
nvm_has_non_aliased() {
@ -62,18 +62,18 @@ nvm_command_info() {
local COMMAND
local INFO
COMMAND="${1}"
if type "${COMMAND}" | nvm_grep -q hashed; then
INFO="$(type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"
elif type "${COMMAND}" | nvm_grep -q aliased; then
if command type "${COMMAND}" | nvm_grep -q hashed; then
INFO="$(command type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"
elif command type "${COMMAND}" | nvm_grep -q aliased; then
# shellcheck disable=SC2230
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g"))"
elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then
INFO="$(which "${COMMAND}") ($(command type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g"))"
elif command type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then
# shellcheck disable=SC2230
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is \\/"; then
INFO="$(type "${COMMAND}" | command awk '{print $3}')"
INFO="$(which "${COMMAND}") ($(command type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
elif command type "${COMMAND}" | nvm_grep -q "^${COMMAND} is \\/"; then
INFO="$(command type "${COMMAND}" | command awk '{print $3}')"
else
INFO="$(type "${COMMAND}")"
INFO="$(command type "${COMMAND}")"
fi
nvm_echo "${INFO}"
}