Compare commits
3 Commits
866123d4fb
...
69ab075c80
| Author | SHA1 | Date | |
|---|---|---|---|
| 69ab075c80 | |||
| 9603b7bedf | |||
| 40b0943fff |
@ -7,4 +7,4 @@ REPOSITORY_BASE=~/src
|
||||
# If a variable is only to be used by a single script, by custom it will be
|
||||
# prefixed with the name of the script.
|
||||
|
||||
REPO_DEFAULT_SEARCH_PREFIX="github.com/buildkite"
|
||||
REPO_DEFAULT_SEARCH_PREFIX="github.com/buildkite/"
|
||||
|
||||
15
init-repo-tools
Executable file
15
init-repo-tools
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Call this your shell config, e.g. ~/.zshrc, and eval the results, e.g.:
|
||||
#
|
||||
# eval "$(/path/to/this/repo/init-repo-tools)"
|
||||
#
|
||||
# Bash scripts can't change the working directory of their callers. This is
|
||||
# right and proper, but changing working directory is `repo`'s entire purpose,
|
||||
# so we need to work around that restriction.
|
||||
#
|
||||
cat <<-EOS
|
||||
repo () {
|
||||
cd \$($(dirname $(realpath ${BASH_SOURCE[0]}))/repo \$@)
|
||||
}
|
||||
EOS
|
||||
@ -1,6 +0,0 @@
|
||||
# Source this into your shell config, e.g. ~/.zshrc
|
||||
|
||||
# Bash scripts can't change the working directory of their callers. This is
|
||||
# right and proper, but we need to work around it in this case.
|
||||
#
|
||||
repo () { cd $($(dirname ${BASH_SOURCE[0]})/repo $@) }
|
||||
4
repo
4
repo
@ -27,9 +27,9 @@ repos=$(find "${REPOSITORY_BASE}" -name '.git' | sed "s|${REPO_BASE}/||" | sed '
|
||||
# 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}" | fzf -1 -0 -q "github.com/buildkite/${1}" --prompt="Repo: ")"
|
||||
selected="$(echo "${repos}" | fzf -1 -0 -q "${REPO_DEFAULT_SEARCH_PREFIX}${1}" --prompt="Repo: ")"
|
||||
|
||||
echo "$REPOSITORY_BASE/$selected"
|
||||
echo "${REPOSITORY_BASE}/${selected}"
|
||||
|
||||
# TODO: It could be super nice to bias in favour of more frequently selected options.
|
||||
# For the last 500 uses (or so):
|
||||
|
||||
Reference in New Issue
Block a user