parent
c6489440dc
commit
3fc82d6b2f
|
@ -45,7 +45,7 @@ nvm_download() {
|
||||||
curl $*
|
curl $*
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||||
-e 's/-L //' \
|
-e 's/-L //' \
|
||||||
-e 's/-I /--server-response /' \
|
-e 's/-I /--server-response /' \
|
||||||
-e 's/-s /-q /' \
|
-e 's/-s /-q /' \
|
||||||
|
|
14
nvm.sh
14
nvm.sh
|
@ -35,7 +35,7 @@ nvm_download() {
|
||||||
curl $*
|
curl $*
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(echo "$*" | sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
|
||||||
-e 's/-L //' \
|
-e 's/-L //' \
|
||||||
-e 's/-I /--server-response /' \
|
-e 's/-I /--server-response /' \
|
||||||
-e 's/-s /-q /' \
|
-e 's/-s /-q /' \
|
||||||
|
@ -201,18 +201,18 @@ nvm_remote_version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_normalize_version() {
|
nvm_normalize_version() {
|
||||||
echo "$1" | sed -e 's/^v//' | \awk -F. '{ printf("%d%06d%06d\n", $1,$2,$3); }'
|
echo "$1" | command sed -e 's/^v//' | \awk -F. '{ printf("%d%06d%06d\n", $1,$2,$3); }'
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_ensure_version_prefix() {
|
nvm_ensure_version_prefix() {
|
||||||
echo "$1" | sed -e 's/^\([0-9]\)/v\1/g'
|
echo "$1" | command sed -e 's/^\([0-9]\)/v\1/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_format_version() {
|
nvm_format_version() {
|
||||||
local VERSION
|
local VERSION
|
||||||
VERSION="$(nvm_ensure_version_prefix "$1")"
|
VERSION="$(nvm_ensure_version_prefix "$1")"
|
||||||
if [ "_$(nvm_num_version_groups "$VERSION")" != "_3" ]; then
|
if [ "_$(nvm_num_version_groups "$VERSION")" != "_3" ]; then
|
||||||
VERSION="$(echo "$VERSION" | sed -e 's/\.*$/.0/')"
|
VERSION="$(echo "$VERSION" | command sed -e 's/\.*$/.0/')"
|
||||||
nvm_format_version "$VERSION"
|
nvm_format_version "$VERSION"
|
||||||
else
|
else
|
||||||
echo "$VERSION"
|
echo "$VERSION"
|
||||||
|
@ -227,14 +227,14 @@ nvm_num_version_groups() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local NVM_NUM_DOTS
|
local NVM_NUM_DOTS
|
||||||
NVM_NUM_DOTS=$(echo "$VERSION" | sed -e 's/^v//' | sed -e 's/\.$//' | sed -e 's/[^\.]//g')
|
NVM_NUM_DOTS=$(echo "$VERSION" | command sed -e 's/^v//' | command sed -e 's/\.$//' | command sed -e 's/[^\.]//g')
|
||||||
local NVM_NUM_GROUPS
|
local NVM_NUM_GROUPS
|
||||||
NVM_NUM_GROUPS=".$NVM_NUM_DOTS"
|
NVM_NUM_GROUPS=".$NVM_NUM_DOTS"
|
||||||
echo "${#NVM_NUM_GROUPS}"
|
echo "${#NVM_NUM_GROUPS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_strip_path() {
|
nvm_strip_path() {
|
||||||
echo "$1" | sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
|
echo "$1" | command sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g"
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_prepend_path() {
|
nvm_prepend_path() {
|
||||||
|
@ -366,7 +366,7 @@ nvm_ls() {
|
||||||
local NUM_VERSION_GROUPS
|
local NUM_VERSION_GROUPS
|
||||||
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
NUM_VERSION_GROUPS="$(nvm_num_version_groups "$PATTERN")"
|
||||||
if [ "_$NUM_VERSION_GROUPS" = "_2" ] || [ "_$NUM_VERSION_GROUPS" = "_1" ]; then
|
if [ "_$NUM_VERSION_GROUPS" = "_2" ] || [ "_$NUM_VERSION_GROUPS" = "_1" ]; then
|
||||||
PATTERN="$(echo "$PATTERN" | sed -e 's/\.*$//g')."
|
PATTERN="$(echo "$PATTERN" | command sed -e 's/\.*$//g')."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d "$(nvm_version_dir new)" ]; then
|
if [ -d "$(nvm_version_dir new)" ]; then
|
||||||
|
|
Loading…
Reference in New Issue