Just go if there's only one (likely) result

This commit is contained in:
Lucas Wilson-Richter
2024-05-17 20:10:55 +10:00
parent 130f7390b8
commit 40648eae2a

5
repo
View File

@ -20,11 +20,12 @@
REPO_BASE=${HOME}/src
repos=$(find -s ${REPO_BASE} -maxdepth 3 -mindepth 3 -type d | sed "s|${REPO_BASE}/||")
repos=$(find -s "${REPO_BASE}" -maxdepth 3 -mindepth 3 -type d -not -path "${REPO_BASE}/repo-tools/*" | sed "s|${REPO_BASE}/||")
# Default to searching within github.com, because that's by far the most common
# place for repos to be.
selected=$(echo "${repos}" | gum filter --header="Pick a repo" --prompt="Repo: " --height=20 --value "github.com/${1}")
# selected=$(echo "${repos}" | gum filter --header="Pick a repo" --prompt="Repo: " --height=20 --value "github.com/${1}")
selected="$(echo "${repos}" | fzf -1 -0 -q "github.com/buildkite/${1}" --prompt="Repo: ")"
echo "$REPO_BASE/$selected"