[Fix] ensure `--help` is intercepted on any command
Co-authored-by: Naomi Quinones <52065567+naomiquinones@users.noreply.github.com> Co-authored-by: Dena Burd <me@Denas-MacBook-Air.local>
parent
a01deb11dc
commit
1bf567bd0b
26
nvm.sh
26
nvm.sh
|
@ -2345,16 +2345,10 @@ nvm() {
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local COMMAND
|
for i in "$@"
|
||||||
COMMAND="${1-}"
|
do
|
||||||
shift
|
case $i in
|
||||||
|
'-h'|'help'|'--help')
|
||||||
# initialize local variables
|
|
||||||
local VERSION
|
|
||||||
local ADDITIONAL_PARAMETERS
|
|
||||||
|
|
||||||
case $COMMAND in
|
|
||||||
'help' | '--help')
|
|
||||||
local NVM_IOJS_PREFIX
|
local NVM_IOJS_PREFIX
|
||||||
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
||||||
local NVM_NODE_PREFIX
|
local NVM_NODE_PREFIX
|
||||||
|
@ -2434,8 +2428,20 @@ nvm() {
|
||||||
nvm_echo 'Note:'
|
nvm_echo 'Note:'
|
||||||
nvm_echo ' to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)'
|
nvm_echo ' to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)'
|
||||||
nvm_echo
|
nvm_echo
|
||||||
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
local COMMAND
|
||||||
|
COMMAND="${1-}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
# initialize local variables
|
||||||
|
local VERSION
|
||||||
|
local ADDITIONAL_PARAMETERS
|
||||||
|
|
||||||
|
case $COMMAND in
|
||||||
"cache")
|
"cache")
|
||||||
case "${1-}" in
|
case "${1-}" in
|
||||||
dir) nvm_cache_dir ;;
|
dir) nvm_cache_dir ;;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo "$@" ; exit 1; }
|
||||||
|
|
||||||
|
\. ../../../nvm.sh
|
||||||
|
|
||||||
|
TERM=dumb nvm clear-cache --help | grep 'Usage:' || die 'did not print help menu'
|
||||||
|
TERM=dumb nvm cache help version | grep 'Usage:' || die 'did not print help menu'
|
||||||
|
TERM=dumb nvm cache -h version| grep 'Usage:' || die 'did not print help menu'
|
Loading…
Reference in New Issue