When auto-printing "help" on a command other than "help", return a nonzero exit code.

master
Jordan Harband 2014-04-25 10:35:52 -07:00
parent bad79e6d77
commit e6bd207624
1 changed files with 5 additions and 5 deletions

10
nvm.sh
View File

@ -422,7 +422,7 @@ nvm() {
"use" ) "use" )
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
nvm help nvm help
return return 127
fi fi
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
nvm_rc_version nvm_rc_version
@ -434,7 +434,7 @@ nvm() {
fi fi
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
nvm help nvm help
return return 127
fi fi
if [ -z "$VERSION" ]; then if [ -z "$VERSION" ]; then
VERSION=`nvm_version $2` VERSION=`nvm_version $2`
@ -484,7 +484,7 @@ nvm() {
fi fi
if [ $VERSION = "N/A" ]; then if [ $VERSION = "N/A" ]; then
nvm help nvm help
return return 127
fi fi
fi fi
@ -564,7 +564,7 @@ nvm() {
;; ;;
"unalias" ) "unalias" )
mkdir -p $NVM_DIR/alias mkdir -p $NVM_DIR/alias
[ $# -ne 2 ] && nvm help && return [ $# -ne 2 ] && nvm help && return 127
[ ! -f "$NVM_DIR/alias/$2" ] && echo "Alias $2 doesn't exist!" && return [ ! -f "$NVM_DIR/alias/$2" ] && echo "Alias $2 doesn't exist!" && return
rm -f $NVM_DIR/alias/$2 rm -f $NVM_DIR/alias/$2
echo "Deleted alias $2" echo "Deleted alias $2"
@ -572,7 +572,7 @@ nvm() {
"copy-packages" ) "copy-packages" )
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
nvm help nvm help
return return 127
fi fi
VERSION=`nvm_version $2` VERSION=`nvm_version $2`
local ROOT=`(nvm use $VERSION && npm -g root)` local ROOT=`(nvm use $VERSION && npm -g root)`