This commit is contained in:
Peder Bergebakken Sundt 2025-03-15 18:07:02 +01:00
parent bb3273687c
commit 145d0acc83

@ -0,0 +1,28 @@
zedr() (
set -euo pipefail
if printf '%s\n' "$(gum --version)" "gum version 0.15.1" | sort -C -V; then
maybe_spin="" # doesn't forward stdin
else
maybe_spin="gum spin --show-output --show-error --"
fi
# echo maybe_spin="$maybe_spin"
host="$(
{
echo localhost
tailscale status --json | jq .Peer[].HostName -r
} | sort -u | fzf --multi --reverse --bind 'ctrl-a:toggle-all' --height=25
)"
if [[ -z "$host" ]]; then
exit
fi
repos=$(
set +e +o pipefail
$maybe_spin xe -j"$(wc -l <<<"$host")" <<<"$host" -s 'timeout 7 ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$1" fd "^\.git$" repos/ --hidden --max-depth 5 -x printf '"'"'"zeditor ssh://%s/~/%s\n"'"'"' "$1" "{//}" 2>/dev/null' | sort
)
fzf <<<"$repos" --reverse --height=25 | bash
)