ronantakizawa/codereview-bench huggingface dataset:
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
  local NVM_MAKE_JOBS
  NVM_MAKE_JOBS="${4-}"

  local ADDITIONAL_PARAMETERS
  ADDITIONAL_PARAMETERS="${5-}"

  local NVM_ARCH
  NVM_ARCH="$(nvm_get_arch)"
  if [ "${NVM_ARCH}" = 'armv6l' ] || [ "${NVM_ARCH}" = 'armv7l' ]; then
    ADDITIONAL_PARAMETERS="--without-snapshot ${ADDITIONAL_PARAMETERS}"
  fi

  if [ -n "${ADDITIONAL_PARAMETERS}" ]; then
    nvm_echo "Additional options while compiling: ${ADDITIONAL_PARAMETERS}"
  fi

  local NVM_OS
  NVM_OS="$(nvm_get_os)"

  local make
  make='make'
  case "${NVM_OS}" in
    'freebsd')
      make='gmake'
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    ;;
    'darwin')
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    ;;
    'aix')
      make='gmake'
    ;;
  esac
  if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5; then
    if [ -z "${CC-}" ] || [ -z "${CXX-}" ] ; then
      nvm_echo "Clang v3.5+ detected! CC or CXX not specified, will use Clang as c/c++ compiler!"
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    fi
  fi

  local tar_compression_flag
  tar_compression_flag='z'
  if nvm_supports_xz "${VERSION}"; then
    tar_compression_flag='J'
  fi

  local tar
  tar='tar'
  if [ "${NVM_OS}" = 'aix' ]; then
    tar='gtar'
  fi

Review comment (suggestion):
hm, this seems like an oversight - there's no `local MAKE_CXX` declaration in this function. let's add one above the `case`.

Code after:
  local NVM_MAKE_JOBS
  NVM_MAKE_JOBS="${4-}"

  local ADDITIONAL_PARAMETERS
  ADDITIONAL_PARAMETERS="${5-}"

  local NVM_ARCH
  NVM_ARCH="$(nvm_get_arch)"
  if [ "${NVM_ARCH}" = 'armv6l' ] || [ "${NVM_ARCH}" = 'armv7l' ]; then
    ADDITIONAL_PARAMETERS="--without-snapshot ${ADDITIONAL_PARAMETERS}"
  fi

  if [ -n "${ADDITIONAL_PARAMETERS}" ]; then
    nvm_echo "Additional options while compiling: ${ADDITIONAL_PARAMETERS}"
  fi

  local NVM_OS
  NVM_OS="$(nvm_get_os)"

  local make
  make='make'
  local MAKE_CXX
  case "${NVM_OS}" in
    'freebsd')
      make='gmake'
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    ;;
    'darwin')
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    ;;
    'aix')
      make='gmake'
    ;;
  esac
  if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5; then
    if [ -z "${CC-}" ] || [ -z "${CXX-}" ] ; then
      nvm_echo "Clang v3.5+ detected! CC or CXX not specified, will use Clang as c/c++ compiler!"
      MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
    fi
  fi

  local tar_compression_flag
  tar_compression_flag='z'
  if nvm_supports_xz "${VERSION}"; then
    tar_compression_flag='J'
  fi

  local tar
  tar='tar'
  if [ "${NVM_OS}" = 'aix' ]; then
    tar='gtar'
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
  if [ -z "$1" ]; then
    return 4
  fi
  case "$1" in
    0) return 1 ;;
    -*) return 3 ;; # some BSDs return false positives for double-negated args
    *)
      [ "$1" -eq "$1" ] 2> /dev/null # returns 2 if it doesn't match
    ;;
  esac
}

# Check version dir permissions
nvm_check_file_permissions() {
  local ZSH_HAS_NONOMATCH_UNSET
  ZSH_HAS_NONOMATCH_UNSET=1
  if nvm_has "setopt"; then
    ZSH_HAS_NONOMATCH_UNSET="$(set +e ; setopt | nvm_grep nonomatch > /dev/null ; nvm_echo $?)"
    setopt nonomatch
  fi
  for FILE in $1/* $1/.[!.]* $1/..?* ; do
      if [ -d "$FILE" ] && ! nvm_check_file_permissions "$FILE"; then
        if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
          setopt nomatch
        fi
        return 2
      elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then
        nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
        if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
          setopt nomatch
        fi
        return 1
      fi
  done
  if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
    setopt nomatch
  fi
  return 0
}

nvm_cache_dir() {
  nvm_echo "${NVM_DIR}/.cache"
}

nvm() {
  if [ $# -lt 1 ]; then
    nvm --help
    return
  fi

  local COMMAND

Review comment (security):
this isn't the same; if the file is a directory but `nvm_check_file_permissions` returns true, i don't want anything to happen. With this change, it ends up hitting the `else` branch.

Code after:
  nvm_echo "$SANITIZED_PATH"
}

nvm_is_natural_num() {
  if [ -z "$1" ]; then
    return 4
  fi
  case "$1" in
    0) return 1 ;;
    -*) return 3 ;; # some BSDs return false positives for double-negated args
    *)
      [ "$1" -eq "$1" ] 2> /dev/null # returns 2 if it doesn't match
    ;;
  esac
}

# Check version dir permissions
nvm_check_file_permissions() {
  local ZSH_HAS_NONOMATCH_UNSET
  ZSH_HAS_NONOMATCH_UNSET=1
  if nvm_has "setopt"; then
    ZSH_HAS_NONOMATCH_UNSET="$(set +e ; setopt | nvm_grep nonomatch > /dev/null ; nvm_echo $?)"
    setopt nonomatch
  fi
  for FILE in $1/* $1/.[!.]* $1/..?* ; do
    if [ -d "$FILE" ]; then
      if ! nvm_check_file_permissions "$FILE"; then
        if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
          setopt nomatch
        fi
        return 2
      fi
    elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then
      nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
      if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
        setopt nomatch
      fi
      return 1
    fi
  done
  if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
    setopt nomatch
  fi
  return 0
}

nvm_cache_dir() {
  nvm_echo "${NVM_DIR}/.cache"
}

nvm() {
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
  # shellcheck disable=SC1001,SC2164
  \cd "$@"
}

nvm_err() {
  >&2 nvm_echo "$@"
}

nvm_grep() {
  GREP_OPTIONS='' command grep "$@"
}

nvm_has() {
  type "${1-}" > /dev/null 2>&1
}

nvm_has_non_aliased() {
  nvm_has "${1-}" && ! nvm_is_alias "${1-}"
}

nvm_is_alias() {
  # this is intentionally not "command alias" so it works in zsh.
  # shellcheck disable=SC1001
  \alias "${1-}" > /dev/null 2>&1
}

nvm_command_info() {
  local COMMAND
  local INFO
  COMMAND="${1}"
  if type "${COMMAND}" | command grep -q hashed; then
    INFO="$(type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"
  elif type "${COMMAND}" | command grep -q aliased; then
    INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g" ))"
  elif type "${COMMAND}" | command grep -q "^${COMMAND} is an alias for"; then
    INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
  elif type "${COMMAND}" | command grep -q "^${COMMAND} is \/"; then
    INFO="$(type "${COMMAND}" | command awk '{print $3}')"
  else
    INFO="$(type "${COMMAND}")"
  fi
  nvm_echo "${INFO}"
}

nvm_has_colors() {
  local NVM_COLORS
  if nvm_has tput; then
    NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
  fi
  [ "${NVM_COLORS:--1}" -ge 8 ]
}

Review comment (suggestion):
Can you elaborate on this one? it doesn't seem to error out the `sed` call when I try it locally.

Code after:
}

nvm_grep() {
  GREP_OPTIONS='' command grep "$@"
}

nvm_has() {
  type "${1-}" > /dev/null 2>&1
}

nvm_has_non_aliased() {
  nvm_has "${1-}" && ! nvm_is_alias "${1-}"
}

nvm_is_alias() {
  # this is intentionally not "command alias" so it works in zsh.
  # shellcheck disable=SC1001
  \alias "${1-}" > /dev/null 2>&1
}

nvm_command_info() {
  local COMMAND
  local INFO
  COMMAND="${1}"
  if type "${COMMAND}" | nvm_grep -q hashed; then
    INFO="$(type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"
  elif type "${COMMAND}" | nvm_grep -q aliased; then
    INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g" ))"
  elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then
    INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
  elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is \\/"; then
    INFO="$(type "${COMMAND}" | command awk '{print $3}')"
  else
    INFO="$(type "${COMMAND}")"
  fi
  nvm_echo "${INFO}"
}

nvm_has_colors() {
  local NVM_COLORS
  if nvm_has tput; then
    NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
  fi
  [ "${NVM_COLORS:--1}" -ge 8 ]
}

nvm_curl_libz_support() {
  curl -V 2>/dev/null | nvm_grep "^Features:" | nvm_grep -q "libz"
}

nvm_curl_use_compression() {
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
  fi
}

# Obtain nvm version from rc file
nvm_rc_version() {
  export NVM_RC_VERSION=''
  local NVMRC_PATH
  NVMRC_PATH="$(nvm_find_nvmrc)"
  if [ ! -e "${NVMRC_PATH}" ]; then
    nvm_err "No .nvmrc file found"
    return 1
  fi
  read -r NVM_RC_VERSION < "${NVMRC_PATH}" || printf ''
  if [ ! -n "${NVM_RC_VERSION}" ]; then
    nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
    return 2
  fi
  nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
}

nvm_clang_version() {
  clang --version | command awk '{ if ($2 == "version") print $3; else if ($3 == "version") print $4 }' | command sed 's/-.*$//g'
}

nvm_curl_version() {
  curl --version | command awk '{ if ($1 == "curl") print $2 }' | command sed 's/-.*$//g'
}

nvm_version_greater() {
  command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (b[i] && b[i] !~ /^[0-9]+$/) { exit(0); }
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);
    }
    exit(4)
  }' "${1#v}" "${2#v}";
}

nvm_version_greater_than_or_equal_to() {
  command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (a[i] < b[i]) exit(3);

Review comment (suggestion):
`nvm_curl_libz_support` uses `curl -V`; are those identical across all curl versions?

If you're not certain, let's stick with `curl -V` to be consistent.

Code after:
# Obtain nvm version from rc file
nvm_rc_version() {
  export NVM_RC_VERSION=''
  local NVMRC_PATH
  NVMRC_PATH="$(nvm_find_nvmrc)"
  if [ ! -e "${NVMRC_PATH}" ]; then
    nvm_err "No .nvmrc file found"
    return 1
  fi
  read -r NVM_RC_VERSION < "${NVMRC_PATH}" || printf ''
  if [ ! -n "${NVM_RC_VERSION}" ]; then
    nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
    return 2
  fi
  nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
}

nvm_clang_version() {
  clang --version | command awk '{ if ($2 == "version") print $3; else if ($3 == "version") print $4 }' | command sed 's/-.*$//g'
}

nvm_curl_version() {
  curl -V | command awk '{ if ($1 == "curl") print $2 }' | command sed 's/-.*$//g'
}

nvm_version_greater() {
  command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (b[i] && b[i] !~ /^[0-9]+$/) { exit(0); }
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);
    }
    exit(4)
  }' "${1#v}" "${2#v}";
}

nvm_version_greater_than_or_equal_to() {
  command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);
    }
    exit(0)
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
        fi

        nvm_list_aliases "${ALIAS-}"
      fi
    ;;
    "unalias")
      local NVM_ALIAS_DIR

      NVM_ALIAS_DIR="$(nvm_alias_path)"
      command mkdir -p "${NVM_ALIAS_DIR}"
      if [ $# -ne 1 ]; then
        >&2 nvm --help
        return 127
      fi
      if [ "${1#*\/}" != "${1-}" ]; then
        nvm_err 'Aliases in subdirectories are not supported.'
        return 1
      fi

      local NVM_IOJS_PREFIX
      local NVM_NODE_PREFIX
      NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
      NVM_NODE_PREFIX="$(nvm_node_prefix)"
      case "$1" in
        "stable" | "unstable" | "${NVM_IOJS_PREFIX}" | "${NVM_NODE_PREFIX}")
          nvm_err "${1-} is a default alias and cannot be deleted"
          return 1
        ;;
      esac

      [ ! -f "${NVM_ALIAS_DIR}/${1-}" ] && nvm_err "Alias ${1-} doesn't exist!" && return
      local NVM_ALIAS_ORIGINAL
      NVM_ALIAS_ORIGINAL="$(nvm_alias "${1}")"
      command rm -f "${NVM_ALIAS_DIR}/${1}"
      nvm_echo "Deleted alias ${1} - restore it with \`nvm alias \"${1}\" \"${NVM_ALIAS_ORIGINAL}\"\`"
    ;;
    "install-latest-npm")
      if [ $# -ne 0 ]; then
        >&2 nvm --help
        return 127
      fi

      nvm_install_latest_npm
    ;;
    "reinstall-packages" | "copy-packages")
      if [ $# -ne 1 ]; then
        >&2 nvm --help
        return 127
      fi

      local PROVIDED_VERSION

Review comment (suggestion):
i'm going to eventually change the terminology here from default to built-in, so let's use this wording:
```suggestion
          nvm_err "${1-} is a default (built-in) alias and cannot be deleted"
```

Code after:
        fi

        nvm_list_aliases "${ALIAS-}"
      fi
    ;;
    "unalias")
      local NVM_ALIAS_DIR
      NVM_ALIAS_DIR="$(nvm_alias_path)"
      command mkdir -p "${NVM_ALIAS_DIR}"
      if [ $# -ne 1 ]; then
        >&2 nvm --help
        return 127
      fi
      if [ "${1#*\/}" != "${1-}" ]; then
        nvm_err 'Aliases in subdirectories are not supported.'
        return 1
      fi

      local NVM_IOJS_PREFIX
      local NVM_NODE_PREFIX
      NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
      NVM_NODE_PREFIX="$(nvm_node_prefix)"
      case "$1" in
        "stable" | "unstable" | "${NVM_IOJS_PREFIX}" | "${NVM_NODE_PREFIX}" | "system")
          nvm_err "${1-} is a default (built-in) alias and cannot be deleted."
          return 1
        ;;
      esac

      [ ! -f "${NVM_ALIAS_DIR}/${1-}" ] && nvm_err "Alias ${1-} doesn't exist!" && return
      local NVM_ALIAS_ORIGINAL
      NVM_ALIAS_ORIGINAL="$(nvm_alias "${1}")"
      command rm -f "${NVM_ALIAS_DIR}/${1}"
      nvm_echo "Deleted alias ${1} - restore it with \`nvm alias \"${1}\" \"${NVM_ALIAS_ORIGINAL}\"\`"
    ;;
    "install-latest-npm")
      if [ $# -ne 0 ]; then
        >&2 nvm --help
        return 127
      fi

      nvm_install_latest_npm
    ;;
    "reinstall-packages" | "copy-packages")
      if [ $# -ne 1 ]; then
        >&2 nvm --help
        return 127
      fi

      local PROVIDED_VERSION
      PROVIDED_VERSION="${1-}"
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
      fi
    else
      nvm use --silent "${NVM_CURRENT}" >/dev/null
    fi
  elif [ "_${NVM_MODE}" != '_none' ]; then
    nvm_err 'Invalid auto mode supplied.'
    return 1
  fi
}

nvm_process_parameters() {
  local NVM_AUTO_MODE
  NVM_AUTO_MODE='use'
  if nvm_supports_source_options; then
    while [ $# -ne 0 ]; do
      case "$1" in
        --install) NVM_AUTO_MODE='install' ;;
        --no-use) NVM_AUTO_MODE='none' ;;
      esac
      shift
    done
  fi
  nvm_auto "${NVM_AUTO_MODE}"
}

nvm_process_parameters "$@"

} # this ensures the entire script is downloaded #


Review comment (suggestion):
should the previous line also check `nvm_has sw_vers`?
```suggestion
    local MACOS_VERSION
    MACOS_VERSION="$(sw_vers -productVersion)"
```
(the "local" line is needed for ksh)

Code after:
  nvm_echo "npm install -g --quiet $1"

  if ! nvm_echo "$1" | command xargs npm install -g --quiet; then
    nvm_err "Failed installing default packages. Please check if your default-packages file or a package in it has problems!"
    return 1
  fi
}

nvm_supports_source_options() {
  # shellcheck disable=SC1091,SC2240
    [ "_$( . /dev/stdin yes 2> /dev/null <<'EOF'
[ $# -gt 0 ] && nvm_echo $1
EOF
  )" = "_yes" ]
}

nvm_supports_xz() {
  if [ -z "${1-}" ]; then
    return 1
  fi

  local NVM_OS
  NVM_OS="$(nvm_get_os)"
  if [ "_${NVM_OS}" = '_darwin' ]; then
    local MACOS_VERSION
    MACOS_VERSION="$(sw_vers -productVersion)"
    if nvm_version_greater "10.9.0" "${MACOS_VERSION}"; then
      # macOS 10.8 and earlier doesn't support extracting xz-compressed tarballs with tar
      return 1
    fi
  elif [ "_${NVM_OS}" = '_freebsd' ]; then
    if ! [ -e '/usr/lib/liblzma.so' ]; then
      # FreeBSD without /usr/lib/liblzma.so doesn't support extracting xz-compressed tarballs with tar
      return 1
    fi
  else
    if ! command which xz >/dev/null 2>&1; then
      # Most OSes without xz on the PATH don't support extracting xz-compressed tarballs with tar
      # (Should correctly handle Linux, SmartOS, maybe more)
      return 1
    fi
  fi

  # all node versions v4.0.0 and later have xz
  if nvm_is_merged_node_version "${1}"; then
    return 0
  fi

  # 0.12x: node v0.12.10 and later have xz
  if nvm_version_greater_than_or_equal_to "${1}" "0.12.10" && nvm_version_greater "0.13.0" "${1}"; then
    return 0
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:

      if [ -n "${NODE_PATH-}" ]; then
        NEWPATH="$(nvm_strip_path "${NODE_PATH}" "/lib/node_modules")"
        if [ "_${NODE_PATH}" != "_${NEWPATH}" ]; then
          export NODE_PATH="${NEWPATH}"
          if [ "$NVM_USE_SILENT" -ne 1 ]; then
            nvm_echo "${NVM_DIR}/*/lib/node_modules removed from \${NODE_PATH}"
          fi
        fi
      fi
      unset NVM_BIN
      unset NVM_INC
    ;;
    "use")
      # Set variables
      local PROVIDED_VERSION
      local NVM_USE_SILENT
      NVM_USE_SILENT=0
      local NVM_DELETE_PREFIX
      NVM_DELETE_PREFIX=0
      local NVM_LTS

      # Iterate through the arguments and execute accordingly
      while [ $# -ne 0 ]; do
        case "$1" in
          "--silent" | "--quiet" | "quiet" | "silent") NVM_USE_SILENT=1 ;;
          --delete-prefix) NVM_DELETE_PREFIX=1 ;;
          --) ;;
          --lts) NVM_LTS='*' ;;
          --lts=*) NVM_LTS="${1##--lts=}" ;;
          --*) ;;
          *)
            if [ -n "${1-}" ]; then
              PROVIDED_VERSION="$1"
            fi
          ;;
        esac
        shift
      done

      if [ -n "${NVM_LTS-}" ]; then
        VERSION="$(nvm_match_version "lts/${NVM_LTS:-*}")"
      elif [ -z "${PROVIDED_VERSION-}" ]; then
        # Get the .nvmrc version depending if quiet mode is on or not
        if [[ $NVM_USE_SILENT -ne 1 ]]; then
          nvm_rc_version
        else
          nvm_rc_version quiet
        fi
        if [ -n "${NVM_RC_VERSION-}" ]; then
          PROVIDED_VERSION="${NVM_RC_VERSION}"

Review comment (suggestion):
```suggestion
          "--silent") NVM_USE_SILENT=1 ;;
```

Code after:
          fi
        fi
      fi
      unset NVM_BIN
      unset NVM_INC
    ;;
    "use")
      local PROVIDED_VERSION
      local NVM_SILENT
      local NVM_SILENT_ARG
      local NVM_DELETE_PREFIX
      NVM_DELETE_PREFIX=0
      local NVM_LTS

      while [ $# -ne 0 ]; do
        case "$1" in
          --silent)
            NVM_SILENT=1
            NVM_SILENT_ARG='--silent'
          ;;
          --delete-prefix) NVM_DELETE_PREFIX=1 ;;
          --) ;;
          --lts) NVM_LTS='*' ;;
          --lts=*) NVM_LTS="${1##--lts=}" ;;
          --*) ;;
          *)
            if [ -n "${1-}" ]; then
              PROVIDED_VERSION="$1"
            fi
          ;;
        esac
        shift
      done

      if [ -n "${NVM_LTS-}" ]; then
        VERSION="$(nvm_match_version "lts/${NVM_LTS:-*}")"
      elif [ -z "${PROVIDED_VERSION-}" ]; then
        NVM_SILENT="${NVM_SILENT:-0}" nvm_rc_version
        if [ -n "${NVM_RC_VERSION-}" ]; then
          PROVIDED_VERSION="${NVM_RC_VERSION}"
          VERSION="$(nvm_version "${PROVIDED_VERSION}")"
        fi
        unset NVM_RC_VERSION
        if [ -z "${VERSION}" ]; then
          nvm_err 'Please see `nvm --help` or https://github.com/nvm-sh/nvm#nvmrc for more information.'
          return 127
        fi
      else
        VERSION="$(nvm_match_version "${PROVIDED_VERSION}")"
      fi
Repository: nvm-sh/nvm
File: nvm.sh (Shell)

Code before:
}

nvm_find_nvmrc() {
  local dir
  dir="$(nvm_find_up '.nvmrc')"
  if [ -e "${dir}/.nvmrc" ]; then
    nvm_echo "${dir}/.nvmrc"
  fi
}

# Obtain the nvm version from the .nvmrc file
nvm_rc_version() {
  # Check if quiet mode is on
  local quiet="false"
  if [ "$1" == "quiet" ]; then
    quiet="true"
  fi
  # Set NVM_RC_VERSION to null before we set it ourselves
  export NVM_RC_VERSION=''
  # Check where .nvmrc exists
  local NVMRC_PATH
  NVMRC_PATH="$(nvm_find_nvmrc)"
  # Give an error if the .nvmrc doesn't exist
  if [ ! -e "${NVMRC_PATH}" ]; then
    # Give an error only if quiet mode is off
    if [[ "$quiet" == "false" ]]; then
      nvm_err "No .nvmrc file found"
    fi
    return 1
  fi
  # Read the .nvmrc file
  NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''
  # Check if .nvmrc is empty
  if [ -z "${NVM_RC_VERSION}" ]; then
    # Give error only if quiet mode is off
    if [[ "$quiet" == "false" ]]; then
      nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
    fi
    return 2
  fi
  # Echo the contents of .nvmrc and where it was found if quiet mode is off
  if [ "$quiet" == "false" ]; then
    nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
  fi
}

nvm_clang_version() {
  clang --version | command awk '{ if ($2 == "version") print $3; else if ($3 == "version") print $4 }' | command sed 's/-.*$//g'
}

nvm_curl_version() {

Review comment (suggestion):
```suggestion
    if [ "$quiet" == "false" ]; then
```

Code after:
}

nvm_find_nvmrc() {
  local dir
  dir="$(nvm_find_up '.nvmrc')"
  if [ -e "${dir}/.nvmrc" ]; then
    nvm_echo "${dir}/.nvmrc"
  fi
}

# Obtain nvm version from rc file
nvm_rc_version() {
  export NVM_RC_VERSION=''
  local NVMRC_PATH
  NVMRC_PATH="$(nvm_find_nvmrc)"
  if [ ! -e "${NVMRC_PATH}" ]; then
    if [ "${NVM_SILENT:-0}" -ne 1 ]; then
      nvm_err "No .nvmrc file found"
    fi
    return 1
  fi
  NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''
  if [ -z "${NVM_RC_VERSION}" ]; then
    if [ "${NVM_SILENT:-0}" -ne 1 ]; then
      nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
    fi
    return 2
  fi
  if [ "${NVM_SILENT:-0}" -ne 1 ]; then
    nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
  fi
}

nvm_clang_version() {
  clang --version | command awk '{ if ($2 == "version") print $3; else if ($3 == "version") print $4 }' | command sed 's/-.*$//g'
}

nvm_curl_version() {
  curl -V | command awk '{ if ($1 == "curl") print $2 }' | command sed 's/-.*$//g'
}

nvm_version_greater() {
  command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (b[i] && b[i] !~ /^[0-9]+$/) { exit(0); }
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);