Skip to content
Myr

[Fix] `nvm debug`: Fix sed syntax error in nvm_command_info()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Peter Dave Hello · committed by Jordan Harband · parent d3a9272 · Browse files · 2 files+9 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−1 removed

  • tests:+8 added−0 removed
  • other:+1 added−1 removed

2 files+9 added−1 removed

modified:test/fast/Unit tests/nvm_command_info+8 added
36 unmodified lines
37WGET_EXPECTED_INFO="$(type wget)"38[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 3), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'"3940cleanup4142# 4. nvm_command_info() should not have standard error43nvm_command_info ls 2>&1 >/dev/null | grep . && die "\`nvm_command_info ls\` should not return standard error message(stage 4)"44nvm_command_info rm 2>&1 >/dev/null | grep . && die "\`nvm_command_info rm\` should not return standard error message(stage 4)"45nvm_command_info git 2>&1 >/dev/null | grep . && die "\`nvm_command_info git\` should not return standard error message(stage 4)"46nvm_command_info grep 2>&1 >/dev/null | grep . && die "\`nvm_command_info grep\` should not return standard error message(stage 4)"4748cleanup
modified:nvm.sh+1 added-1 removed
46 unmodified lines
47 local COMMAND48 local INFO49 COMMAND="${1}"50 if type "${COMMAND}" | nvm_grep -q hashed; then51 INFO="$(type "${COMMAND}" | command sed -E 's/\(|)//g' | command awk '{print $4}')"51 INFO="$(type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"52 elif type "${COMMAND}" | nvm_grep -q aliased; then53 INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g" ))"54 elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then55 INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
3529 unmodified lines