parent
e58d4abf11
commit
12ca8f2607
3
nvm.sh
3
nvm.sh
|
@ -13,7 +13,8 @@ nvm_has() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_is_alias() {
|
nvm_is_alias() {
|
||||||
command alias "$1" > /dev/null 2>&1
|
# this is intentionally not "command alias" so it works in zsh.
|
||||||
|
\alias "$1" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_get_latest() {
|
nvm_get_latest() {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cleanup () { unalias foo; unalias grep; }
|
||||||
|
die () { echo $@ ; cleanup ; exit 1; }
|
||||||
|
|
||||||
|
. ../../../nvm.sh
|
||||||
|
|
||||||
|
alias foo='bar'
|
||||||
|
nvm_is_alias foo || die '"nvm_is_alias foo" was not true'
|
||||||
|
|
||||||
|
! nvm_is_alias nvm_is_alias || die '"nvm_is_alias nvm_is_alias was not false'
|
||||||
|
|
||||||
|
alias grep='grep'
|
||||||
|
unalias grep || die '"unalias grep" failed'
|
||||||
|
! nvm_is_alias grep || die '"nvm_is_alias grep" with unaliased grep was not false'
|
||||||
|
|
||||||
|
alias grep='grep'
|
||||||
|
nvm_is_alias grep || die '"nvm_is_alias grep" with aliased grep was not true'
|
||||||
|
|
||||||
|
cleanup
|
Loading…
Reference in New Issue