Merge pull request #804 from return42/minor-fix

[mod] lib_nvm.sh: minor improvements / no functional change
This commit is contained in:
Martin Fischer 2022-01-24 17:58:16 +01:00 committed by GitHub
commit 7ce7625117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -26,11 +26,12 @@ NVM_LOCAL_FOLDER=.nvm
nvm.env() { nvm.env() {
source "${NVM_DIR}/nvm.sh" source "${NVM_DIR}/nvm.sh"
source "${NVM_DIR}/bash_completion" source "${NVM_DIR}/bash_completion"
[ "$VERBOSE" = "1" ] && info_msg "sourced NVM environment from ${NVM_DIR}"
} }
nvm.is_installed() { nvm.is_installed() {
# is true if NVM is installed / in $HOME or even in <repo-root>/.nvm # is true if NVM is installed / in $HOME or even in <repo-root>/.nvm
[[ -d "${NVM_DIR}" ]] [[ -f "${NVM_DIR}/nvm.sh" ]]
} }
if [[ -z "${NVM_DIR}" ]]; then if [[ -z "${NVM_DIR}" ]]; then
@ -40,7 +41,6 @@ fi
export NVM_DIR export NVM_DIR
if nvm.is_installed; then if nvm.is_installed; then
[ "$VERBOSE" = "1" ] && info_msg "source NVM environment from ${NVM_DIR}"
nvm.env nvm.env
else else
# if nvm is not installed, use this function as a wrapper # if nvm is not installed, use this function as a wrapper
@ -58,7 +58,7 @@ nvm.is_local() {
[ "${NVM_DIR}" = "$(git rev-parse --show-toplevel)/${NVM_LOCAL_FOLDER}" ] [ "${NVM_DIR}" = "$(git rev-parse --show-toplevel)/${NVM_LOCAL_FOLDER}" ]
} }
nvm.min_node(){ nvm.min_node() {
# usage: nvm.min_node 16.3.0 # usage: nvm.min_node 16.3.0
# #
@ -87,7 +87,7 @@ nvm.min_node(){
# implement nvm command line # implement nvm command line
# -------------------------- # --------------------------
nvm.help(){ nvm.help() {
cat <<EOF cat <<EOF
nvm.: use nvm (without dot) to execute nvm commands directly nvm.: use nvm (without dot) to execute nvm commands directly
install : install NVM locally at $(git rev-parse --show-toplevel)/${NVM_LOCAL_FOLDER} install : install NVM locally at $(git rev-parse --show-toplevel)/${NVM_LOCAL_FOLDER}