mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
Merge 293c6d198b
into cbdd41eee2
This commit is contained in:
commit
7316fae1be
@ -3,7 +3,7 @@
|
|||||||
{ # this ensures the entire script is downloaded #
|
{ # this ensures the entire script is downloaded #
|
||||||
|
|
||||||
nvm_has() {
|
nvm_has() {
|
||||||
type "$1" > /dev/null 2>&1
|
command which "${1-}" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_install_dir() {
|
nvm_install_dir() {
|
||||||
|
2
nvm.sh
2
nvm.sh
@ -36,7 +36,7 @@ nvm_grep() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvm_has() {
|
nvm_has() {
|
||||||
type "${1-}" > /dev/null 2>&1
|
command which "${1-}" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_has_non_aliased() {
|
nvm_has_non_aliased() {
|
||||||
|
@ -4,9 +4,9 @@ die () { echo "$@" ; exit 1; }
|
|||||||
|
|
||||||
\. ../../../nvm.sh
|
\. ../../../nvm.sh
|
||||||
|
|
||||||
nvm_has cat && type cat > /dev/null || die 'nvm_has locates "cat" properly'
|
nvm_has cat && command which cat > /dev/null || die 'nvm_has locates "cat" properly'
|
||||||
|
|
||||||
[ "~$(nvm_has foobarbaz 2>&1)" = "~" ] || die "nvm_has does not suppress error output"
|
[ "~$(nvm_has foobarbaz 2>&1)" = "~" ] || die "nvm_has does not suppress error output"
|
||||||
|
|
||||||
! nvm_has foobarbaz && ! type foobarbaz >/dev/null 2>&1 || die "nvm_has does not return a nonzero exit code when not found"
|
! nvm_has foobarbaz && ! command which foobarbaz >/dev/null 2>&1 || die "nvm_has does not return a nonzero exit code when not found"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user