Created
May 15, 2023 17:44
-
-
Save foysavas/4da1d610d7b097337921a38fe416ee55 to your computer and use it in GitHub Desktop.
direnv use_nvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_nvm() | |
{ | |
local version | |
version="${1}" | |
if [[ -e .node-version ]]; then version=$(<.node-version) | |
elif [[ -e .nvmrc ]]; then version=$(<.nvmrc) | |
fi | |
if [[ -e ~/.nvm/nvm.sh ]]; then | |
source ~/.nvm/nvm.sh | |
nvm use "${version}" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment