From dc1d3aa9436b64fd144a0844f6cd05a1a5253788 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 17 Sep 2016 09:24:42 -0700 Subject: [PATCH] [Refactor] `nvm_install_source`, `nvm_install_binary`, `nvm_download_artifact`: ensure a version is provided. --- nvm.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nvm.sh b/nvm.sh index ae9f6a1..adb006c 100644 --- a/nvm.sh +++ b/nvm.sh @@ -1516,6 +1516,11 @@ nvm_install_binary() { local PREFIXED_VERSION PREFIXED_VERSION="${3-}" + if [ -z "${PREFIXED_VERSION}" ]; then + nvm_err 'A version number is required.' + return 3 + fi + local VERSION VERSION="$(nvm_strip_iojs_prefix "${PREFIXED_VERSION}")" @@ -1631,6 +1636,11 @@ nvm_download_artifact() { local VERSION VERSION="${4}" + if [ -z "${VERSION}" ]; then + nvm_err 'A version number is required.' + return 3 + fi + if [ "${KIND}" = 'binary' ] && ! nvm_binary_available "${VERSION}"; then nvm_err "No precompiled binary available for ${VERSION}." return @@ -1745,6 +1755,11 @@ nvm_install_source() { local PREFIXED_VERSION PREFIXED_VERSION="${3-}" + if [ -z "${PREFIXED_VERSION}" ]; then + nvm_err 'A version number is required.' + return 3 + fi + local VERSION VERSION="$(nvm_strip_iojs_prefix "${PREFIXED_VERSION}")"