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 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
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
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
fi
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
fi
@ -1517,9 +1525,13 @@ nvm() {
command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
fi
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
[ $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
;;
"run" )