Make `nvm_curl` do a runtime check if `curl` is available.
parent
eda8ffbcc4
commit
74cc1eb022
|
@ -11,22 +11,21 @@ if [ -z "$NVM_DIR" ]; then
|
||||||
NVM_DIR="$HOME/.nvm"
|
NVM_DIR="$HOME/.nvm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if nvm_has "curl"; then
|
|
||||||
nvm_curl() {
|
nvm_curl() {
|
||||||
|
if nvm_has "curl"; then
|
||||||
curl $*
|
curl $*
|
||||||
}
|
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
nvm_curl() {
|
|
||||||
ARGS="$*"
|
ARGS="$*"
|
||||||
ARGS=${ARGS/--progress-bar /}
|
ARGS=${ARGS/--progress-bar /}
|
||||||
ARGS=${ARGS/-L /}
|
ARGS=${ARGS/-L /}
|
||||||
|
ARGS=${ARGS/-I /}
|
||||||
ARGS=${ARGS/-s /-q }
|
ARGS=${ARGS/-s /-q }
|
||||||
ARGS=${ARGS/-o /-O }
|
ARGS=${ARGS/-o /-O }
|
||||||
ARGS=${ARGS/-C /-c }
|
ARGS=${ARGS/-C /-c }
|
||||||
wget "$ARGS"
|
wget $ARGS
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
install_nvm_from_git() {
|
install_nvm_from_git() {
|
||||||
if [ -z "$NVM_SOURCE" ]; then
|
if [ -z "$NVM_SOURCE" ]; then
|
||||||
|
|
6
nvm.sh
6
nvm.sh
|
@ -12,13 +12,11 @@ nvm_has() {
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
if nvm_has "curl"; then
|
|
||||||
nvm_curl() {
|
nvm_curl() {
|
||||||
|
if nvm_has "curl"; then
|
||||||
curl $*
|
curl $*
|
||||||
}
|
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
nvm_curl() {
|
|
||||||
ARGS="$*"
|
ARGS="$*"
|
||||||
ARGS=${ARGS/--progress-bar /}
|
ARGS=${ARGS/--progress-bar /}
|
||||||
ARGS=${ARGS/-L /}
|
ARGS=${ARGS/-L /}
|
||||||
|
@ -27,8 +25,8 @@ elif nvm_has "wget"; then
|
||||||
ARGS=${ARGS/-o /-O }
|
ARGS=${ARGS/-o /-O }
|
||||||
ARGS=${ARGS/-C /-c }
|
ARGS=${ARGS/-C /-c }
|
||||||
wget "$ARGS"
|
wget "$ARGS"
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Make zsh glob matching behave same as bash
|
# Make zsh glob matching behave same as bash
|
||||||
# This fixes the "zsh: no matches found" errors
|
# This fixes the "zsh: no matches found" errors
|
||||||
|
|
Loading…
Reference in New Issue