fast-nvm: no need to sort function output

This commit is contained in:
Guilherme Rugai Freire 2021-08-23 09:58:01 -03:00
parent 9014ff7043
commit bfeef18cf4
No known key found for this signature in database
GPG Key ID: 0F9FE41723A8A297

View File

@ -5,19 +5,15 @@ list_nvmrc_recursive() {
if [ "$DIR" != "/" ]; then list_nvmrc_recursive "$PARENT_DIR"; fi;
}
list_nvmrc() {
list_nvmrc_recursive . | sort
}
export PATH="$HOME/.nvm/versions/node/$(/bin/cat $HOME/.nvm/alias/default)/bin:$PATH"
nvm() {
. $HOME/.nvm/nvm.sh; nvm "$@"
}
DEFAULT=$(list_nvmrc)
DEFAULT=$(list_nvmrc_recursive .)
cd() {
if builtin cd "$@" 2>/dev/null; then
FOUND="$(list_nvmrc)"
FOUND="$(list_nvmrc_recursive .)"
if [ "$FOUND" != "" ] && [ "$DEFAULT" != "$FOUND" ]; then
DEFAULT=$FOUND
nvm use