plugins/nvm: use `_command_exists`

Addresses bash-it/bash-it#1632

alsö, quote variable, &c.
pull/1938/head
John D Pell 2021-09-09 16:16:51 -07:00
parent a7955b972c
commit 9378a8318f
1 changed files with 7 additions and 6 deletions

View File

@ -1,22 +1,23 @@
# Bash-it no longer bundles nvm, as this was quickly becoming outdated. # shellcheck shell=bash
# #
# BASH_IT_LOAD_PRIORITY: 225 # BASH_IT_LOAD_PRIORITY: 225
# #
# Bash-it no longer bundles nvm, as this was quickly becoming outdated.
# Please install nvm from https://github.com/creationix/nvm.git if you want to use it. # Please install nvm from https://github.com/creationix/nvm.git if you want to use it.
cite about-plugin cite about-plugin
about-plugin 'node version manager configuration' about-plugin 'node version manager configuration'
export NVM_DIR=${NVM_DIR:-$HOME/.nvm} export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# This loads nvm # This loads nvm
if _bash_it_homebrew_check && [ -s "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" ] if _bash_it_homebrew_check && [[ -s "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" ]]
then then
. "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh" source "${BASH_IT_HOMEBREW_PREFIX}/nvm.sh"
else else
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" [[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
fi fi
if ! command -v nvm &>/dev/null if ! _command_exists nvm
then then
function nvm() { function nvm() {
echo "Bash-it no longer bundles the nvm script. Please install the latest version from" echo "Bash-it no longer bundles the nvm script. Please install the latest version from"