Expanding to full if statements because the shorthand results in non-zero exit codes

Alan Quach 2015-07-09 18:40:52 +10:00
parent 2da44f90d2
commit 98e40a8da5
1 changed files with 18 additions and 6 deletions

24
nvm.sh
View File

@ -1470,17 +1470,25 @@ nvm() {
if [ "_$VERSION" = '_system' ]; then if [ "_$VERSION" = '_system' ]; then
if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then
[ $silent -ne 1 ] && echo "Now using system version of node: $(node -v 2>/dev/null)$(nvm_print_npm_version)" if [ $silent -ne 1 ]; then
echo "Now using system version of node: $(node -v 2>/dev/null)$(nvm_print_npm_version)"
fi
return return
elif nvm_has_system_iojs && nvm deactivate >/dev/null 2>&1; then elif nvm_has_system_iojs && nvm deactivate >/dev/null 2>&1; then
[ $silent -ne 1 ] && echo "Now using system version of io.js: $(iojs --version 2>/dev/null)$(nvm_print_npm_version)" if [ $silent -ne 1 ]; then
echo "Now using system version of io.js: $(iojs --version 2>/dev/null)$(nvm_print_npm_version)"
fi
return return
else else
[ $silent -ne 1 ] && echo "System version of node not found." >&2 if [ $silent -ne 1 ]; then
echo "System version of node not found." >&2
fi
return 127 return 127
fi fi
elif [ "_$VERSION" = "_∞" ]; then elif [ "_$VERSION" = "_∞" ]; then
[ $silent -ne 1 ] && echo "The alias \"$PROVIDED_VERSION\" leads to an infinite loop. Aborting." >&2 if [ $silent -ne 1 ]; then
echo "The alias \"$PROVIDED_VERSION\" leads to an infinite loop. Aborting." >&2
fi
return 8 return 8
fi fi
@ -1517,9 +1525,13 @@ nvm() {
command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current" command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
fi fi
if nvm_is_iojs_version "$VERSION"; then if nvm_is_iojs_version "$VERSION"; then
[ $silent -ne 1 ] && echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm_print_npm_version)" if [ $silent -ne 1 ]; then
echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm_print_npm_version)"
fi
else else
[ $silent -ne 1 ] && echo "Now using node $VERSION$(nvm_print_npm_version)" if [ $silent -ne 1 ]; then
echo "Now using node $VERSION$(nvm_print_npm_version)"
fi
fi fi
;; ;;
"run" ) "run" )