From b69f0f8f2d73cd6d5100f521895edc170654c5de Mon Sep 17 00:00:00 2001 From: Esteban Vincent <73063856+EstebanVincent@users.noreply.github.com> Date: Thu, 21 May 2026 17:40:51 +0200 Subject: [PATCH] feat(open-repo): add REPO_PATH support for direct path entries (#6) --- scripts/open-repo.zsh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/open-repo.zsh b/scripts/open-repo.zsh index 76252a8..8b7f0d0 100755 --- a/scripts/open-repo.zsh +++ b/scripts/open-repo.zsh @@ -29,14 +29,28 @@ while true; do (( i++ )) done -if [[ ${#roots[@]} -eq 0 ]]; then - echo "❌ No REPO_ROOT_* defined in open-repo.env" +# Collect REPO_PATH_1, REPO_PATH_2, … (added directly, not searched within) +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 fi 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" \ | head -1 )