Find `.nvmrc` files upwards.

master
Jordan Harband 2014-04-28 23:27:10 -07:00
parent 66455f7c77
commit 038c1f3d0f
1 changed files with 7 additions and 3 deletions

10
nvm.sh
View File

@ -35,9 +35,13 @@ if [ -z "$NVM_NODEJS_ORG_MIRROR" ]; then
fi fi
nvm_find_nvmrc() { nvm_find_nvmrc() {
if [ -e '.nvmrc' ]; then typeset dir="$PWD"
echo '.nvmrc' typeset found=""
fi while [ "$dir" != "/" ] && [ "$found" = "" ]; do
found=$(find "$dir" -maxdepth 1 -name ".nvmrc")
dir=$(cd "$dir/.." && pwd -P)
done
echo $found
} }
# Obtain nvm version from rc file # Obtain nvm version from rc file