Making `help` error output actually output to stderr consistently.
parent
5802ac3ea7
commit
230b479648
30
nvm.sh
30
nvm.sh
|
@ -1112,8 +1112,8 @@ nvm() {
|
||||||
version_not_provided=1
|
version_not_provided=1
|
||||||
nvm_rc_version
|
nvm_rc_version
|
||||||
if [ -z "$NVM_RC_VERSION" ]; then
|
if [ -z "$NVM_RC_VERSION" ]; then
|
||||||
nvm help
|
>&2 nvm help
|
||||||
return
|
return 127
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1218,7 +1218,10 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"uninstall" )
|
"uninstall" )
|
||||||
[ $# -ne 2 ] && nvm help && return
|
if [ $# -ne 2 ]; then
|
||||||
|
>&2 nvm help
|
||||||
|
return 127
|
||||||
|
fi
|
||||||
|
|
||||||
local PATTERN
|
local PATTERN
|
||||||
PATTERN="$2"
|
PATTERN="$2"
|
||||||
|
@ -1298,11 +1301,6 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"use" )
|
"use" )
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
nvm help
|
|
||||||
return 127
|
|
||||||
fi
|
|
||||||
|
|
||||||
local PROVIDED_VERSION
|
local PROVIDED_VERSION
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
nvm_rc_version
|
nvm_rc_version
|
||||||
|
@ -1330,7 +1328,7 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
nvm help
|
>&2 nvm help
|
||||||
return 127
|
return 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1400,7 +1398,7 @@ nvm() {
|
||||||
VERSION='N/A'
|
VERSION='N/A'
|
||||||
fi
|
fi
|
||||||
if [ $VERSION = "N/A" ]; then
|
if [ $VERSION = "N/A" ]; then
|
||||||
nvm help
|
>&2 nvm help
|
||||||
return 127
|
return 127
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1549,7 +1547,7 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
fi
|
fi
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
nvm help
|
>&2 nvm help
|
||||||
return 127
|
return 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1633,14 +1631,17 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
|
||||||
local NVM_ALIAS_DIR
|
local NVM_ALIAS_DIR
|
||||||
NVM_ALIAS_DIR="$(nvm_alias_path)"
|
NVM_ALIAS_DIR="$(nvm_alias_path)"
|
||||||
command mkdir -p "$NVM_ALIAS_DIR"
|
command mkdir -p "$NVM_ALIAS_DIR"
|
||||||
[ $# -ne 2 ] && nvm help && return 127
|
if [ $# -ne 2 ]; then
|
||||||
|
>&2 nvm help
|
||||||
|
return 127
|
||||||
|
fi
|
||||||
[ ! -f "$NVM_ALIAS_DIR/$2" ] && echo "Alias $2 doesn't exist!" >&2 && return
|
[ ! -f "$NVM_ALIAS_DIR/$2" ] && echo "Alias $2 doesn't exist!" >&2 && return
|
||||||
command rm -f "$NVM_ALIAS_DIR/$2"
|
command rm -f "$NVM_ALIAS_DIR/$2"
|
||||||
echo "Deleted alias $2"
|
echo "Deleted alias $2"
|
||||||
;;
|
;;
|
||||||
"reinstall-packages" | "copy-packages" )
|
"reinstall-packages" | "copy-packages" )
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
nvm help
|
>&2 nvm help
|
||||||
return 127
|
return 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1690,7 +1691,8 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
|
||||||
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
|
unset RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_DIR NVM_CD_FLAGS > /dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
nvm help
|
>&2 nvm help
|
||||||
|
return 127
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue