Skip to content

Commit 06a9179

Browse files
committed
[Refactor] combine sed -e invocations/arguments
1 parent 74eb396 commit 06a9179

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

nvm.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,17 @@ nvm_download() {
136136
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
137137
elif nvm_has "wget"; then
138138
# Emulate curl with wget
139-
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
140-
-e 's/--compressed //' \
141-
-e 's/--fail //' \
142-
-e 's/-L //' \
143-
-e 's/-I /--server-response /' \
144-
-e 's/-s /-q /' \
145-
-e 's/-sS /-nv /' \
146-
-e 's/-o /-O /' \
147-
-e 's/-C - /-c /')
139+
ARGS=$(nvm_echo "$@" | command sed "
140+
s/--progress-bar /--progress=bar /
141+
s/--compressed //
142+
s/--fail //
143+
s/-L //
144+
s/-I /--server-response /
145+
s/-s /-q /
146+
s/-sS /-nv /
147+
s/-o /-O /
148+
s/-C - /-c /
149+
")
148150

149151
if [ -n "${NVM_AUTH_HEADER:-}" ]; then
150152
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
@@ -2732,7 +2734,7 @@ nvm_npm_global_modules() {
27322734
local NPMLIST
27332735
local VERSION
27342736
VERSION="$1"
2735-
NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed 1,1d | nvm_grep -v 'UNMET PEER DEPENDENCY')
2737+
NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed -e '1d' -e '/UNMET PEER DEPENDENCY/d')
27362738

27372739
local INSTALLS
27382740
INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)

0 commit comments

Comments
 (0)