[New] aliases: skip leading blank lines in alias file
parent
6aeab3349c
commit
8241287349
2
nvm.sh
2
nvm.sh
|
@ -1141,7 +1141,7 @@ nvm_alias() {
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
command cat "${NVM_ALIAS_PATH}"
|
command awk 'NF' "${NVM_ALIAS_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_ls_current() {
|
nvm_ls_current() {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die() { echo "$@" ; exit 1; }
|
||||||
|
|
||||||
|
export NVM_DIR="$(cd ../../.. && pwd)"
|
||||||
|
|
||||||
|
\. "${NVM_DIR}/nvm.sh"
|
||||||
|
\. ../../common.sh
|
||||||
|
|
||||||
|
echo "
|
||||||
|
|
||||||
|
v0.0.1
|
||||||
|
" > ../../../alias/test-blank-lines
|
||||||
|
|
||||||
|
EXPECTED='v0.0.1'
|
||||||
|
ACTUAL="$(nvm_alias test-blank-lines)"
|
||||||
|
EXIT_CODE="$(nvm_alias test-blank-lines 2>&1 >/dev/null; echo $?)"
|
||||||
|
|
||||||
|
[ "${ACTUAL}" = "${EXPECTED}" ] || die "expected >${EXPECTED}<, got >${ACTUAL}<"
|
||||||
|
[ "${EXIT_CODE}" = '0' ] || die "expected exit code 0, got ${EXIT_CODE}"
|
|
@ -15,3 +15,4 @@ rm -f "../../../alias/unstable"
|
||||||
rm -f "../../../alias/node"
|
rm -f "../../../alias/node"
|
||||||
rm -f "../../../alias/iojs"
|
rm -f "../../../alias/iojs"
|
||||||
rm -f "../../../alias/default"
|
rm -f "../../../alias/default"
|
||||||
|
rm -f "../../../alias/test-blank-lines"
|
||||||
|
|
Loading…
Reference in New Issue