zedr
This commit is contained in:
28
users/pbsds/home/profiles/bashrc.d/zedr.sh
Normal file
28
users/pbsds/home/profiles/bashrc.d/zedr.sh
Normal file
@@ -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
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user