feat(open-repo): add REPO_PATH support for direct path entries (#6)
This commit is contained in:
+18
-4
@@ -29,14 +29,28 @@ while true; do
|
|||||||
(( i++ ))
|
(( i++ ))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#roots[@]} -eq 0 ]]; then
|
# Collect REPO_PATH_1, REPO_PATH_2, … (added directly, not searched within)
|
||||||
echo "❌ No REPO_ROOT_* defined in open-repo.env"
|
paths=()
|
||||||
|
i=1
|
||||||
|
while true; do
|
||||||
|
varname="REPO_PATH_$i"
|
||||||
|
val="${(P)varname}"
|
||||||
|
[[ -z "$val" ]] && break
|
||||||
|
paths+=("$val")
|
||||||
|
(( i++ ))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${#roots[@]} -eq 0 && ${#paths[@]} -eq 0 ]]; then
|
||||||
|
echo "❌ No REPO_ROOT_* or REPO_PATH_* defined in open-repo.env"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
selected=$(
|
selected=$(
|
||||||
find "${roots[@]}" \
|
{
|
||||||
-mindepth 1 -maxdepth "${REPO_DEPTH:-3}" -type d 2>/dev/null \
|
[[ ${#roots[@]} -gt 0 ]] && \
|
||||||
|
find "${roots[@]}" -mindepth 1 -maxdepth "${REPO_DEPTH:-3}" -type d 2>/dev/null
|
||||||
|
[[ ${#paths[@]} -gt 0 ]] && printf '%s\n' "${paths[@]}"
|
||||||
|
} \
|
||||||
| fzf --filter="$1" \
|
| fzf --filter="$1" \
|
||||||
| head -1
|
| head -1
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user