repo: Don't cd unnecessarily
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
#
|
#
|
||||||
cat <<-EOS
|
cat <<-EOS
|
||||||
repo () {
|
repo () {
|
||||||
cd \$($(dirname $(realpath ${BASH_SOURCE[0]}))/repo \$@)
|
r=\$($(dirname $(realpath ${BASH_SOURCE[0]}))/repo \$@)
|
||||||
|
[[ "\$r" != "." ]] && [[ "\$r" != "\$(pwd)/" ]] && cd \$r
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
7
repo
7
repo
@ -27,9 +27,14 @@ repos=$(find "${REPOSITORY_BASE}" -maxdepth 5 -name '.git' | sed "s|${REPOSITORY
|
|||||||
# Default to searching within github.com, because that's by far the most common
|
# Default to searching within github.com, because that's by far the most common
|
||||||
# place for repos to be.
|
# 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 "${REPO_DEFAULT_SEARCH_PREFIX}${1}" --prompt="Repo: ")"
|
selected="$(echo "${repos}" | fzf -1 -0 -q "${1:-${REPO_DEFAULT_SEARCH_PREFIX}}" --prompt="Repo: ")"
|
||||||
|
|
||||||
|
# Do nothing if no repo was selected
|
||||||
|
if [ -n "${selected}" ]; then
|
||||||
echo "${REPOSITORY_BASE}/${selected}"
|
echo "${REPOSITORY_BASE}/${selected}"
|
||||||
|
else
|
||||||
|
echo '.'
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO: It could be super nice to bias in favour of more frequently selected options.
|
# TODO: It could be super nice to bias in favour of more frequently selected options.
|
||||||
# For the last 500 uses (or so):
|
# For the last 500 uses (or so):
|
||||||
|
|||||||
Reference in New Issue
Block a user