Skip to content

Instantly share code, notes, and snippets.

@foysavas
Created May 15, 2023 17:44
Show Gist options
  • Save foysavas/4da1d610d7b097337921a38fe416ee55 to your computer and use it in GitHub Desktop.
Save foysavas/4da1d610d7b097337921a38fe416ee55 to your computer and use it in GitHub Desktop.
direnv use_nvm
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