This commit is contained in:
cutemeli
2025-12-22 10:35:30 +00:00
parent 0bfc6c8425
commit 5ce7ca2c5d
38927 changed files with 0 additions and 4594700 deletions

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env bash
# Usage: nodenv version-file [<dir>]
# Summary: Detect the file that sets the current nodenv version
set -e
[ -n "$NODENV_DEBUG" ] && set -x
target_dir="$1"
find_local_version_file() {
local root="$1"
while ! [[ "$root" =~ ^//[^/]*$ ]]; do
if [ -s "${root}/.node-version" ]; then
echo "${root}/.node-version"
return 0
fi
[ -n "$root" ] || break
root="${root%/*}"
done
return 1
}
if [ -n "$target_dir" ]; then
find_local_version_file "$target_dir"
else
find_local_version_file "$NODENV_DIR" || {
[ "$NODENV_DIR" != "$PWD" ] && find_local_version_file "$PWD"
} || echo "${NODENV_ROOT}/version"
fi