Add walkup for now

This commit is contained in:
DarthMooMancer
2025-05-11 15:38:57 -04:00
parent 734b60f145
commit acb859f9e5
5 changed files with 42 additions and 23 deletions
Executable
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Start from the current directory
DIR="$(pwd)"
# Walk up until we find a marker or reach root
while [[ ! -f "$DIR/CMakeLists.txt" && \
! -f "$DIR/package.json" && \
! -d "$DIR/.git" && \
"$DIR" != "/" ]]; do
DIR="$(dirname "$DIR")"
done
# Check if root was reached without finding anything
if [[ "$DIR" == "/" ]]; then
echo "❌ Project root not found."
exit 1
fi
echo "✅ Project root found at: $DIR"