lkajsd
This commit is contained in:
parent
47a02be2cd
commit
e0429c9081
@ -35,14 +35,17 @@ zeditor-remote() {
|
|||||||
if [[ -r /etc/resolv.conf && -r "$HOME"/.ssh/known_hosts ]]; then
|
if [[ -r /etc/resolv.conf && -r "$HOME"/.ssh/known_hosts ]]; then
|
||||||
local -a hosts
|
local -a hosts
|
||||||
readarray -d $'\n' -t hosts < <(
|
readarray -d $'\n' -t hosts < <(
|
||||||
cut <"$HOME"/.ssh/known_hosts -d' ' -f1 | sort -u \
|
cut <"$HOME"/.ssh/known_hosts -d' ' -f1 | sort -u \
|
||||||
| grep -E "(\\.$(hostname --domain)|^[^.]*)$"
|
| grep -Ev '^([0-9]{0,3}\.){3}[0-9]{0,3}$' \
|
||||||
|
| grep -Ev '^([0-9a-fA-F]{0,4}:){0,7}:?([0-9a-fA-F]{0,4}:){0,6}[0-9a-fA-F]{0,4}$'
|
||||||
)
|
)
|
||||||
local -a domains
|
local -a domains
|
||||||
readarray -d ' ' -t domains < <(
|
readarray -d ' ' -t domains < <(
|
||||||
grep </etc/resolv.conf '^search ' | cut -d' ' -f2-
|
grep </etc/resolv.conf '^search ' | cut -d' ' -f2-
|
||||||
)
|
)
|
||||||
printf '%s\n' "${hosts[@]}" | sed -E "s/\\.($(IFS='|'; printf "%s" "${domains[*]}"))\$//g"
|
printf '%s\n' "${hosts[@]}" \
|
||||||
|
| sed -E "s/\\.($(IFS='|'; printf "%s" "${domains[*]}"))\$//g" \
|
||||||
|
| grep -v '\.'
|
||||||
fi
|
fi
|
||||||
} | grep -v '^localhost$' | sort -u
|
} | grep -v '^localhost$' | sort -u
|
||||||
} | fzf --multi --reverse --bind 'ctrl-a:toggle-all' --height=25 --cycle \
|
} | fzf --multi --reverse --bind 'ctrl-a:toggle-all' --height=25 --cycle \
|
||||||
@ -63,11 +66,11 @@ zeditor-remote() {
|
|||||||
sshargs=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null)
|
sshargs=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null)
|
||||||
if [[ "$host" = localhost ]]; then
|
if [[ "$host" = localhost ]]; then
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
fd "^\.git$" repos/ "${fdargs[@]}" -x printf '~/%q\n' "{//}"
|
fd "^\.git$" repos/ "${fdargs[@]}" -L -x printf '~/%q\n' "{//}"
|
||||||
else
|
else
|
||||||
# TODO: report timeouts?
|
# TODO: report timeouts?
|
||||||
timeout 5 ssh "${sshargs[@]}" 2>/dev/null "$host" \
|
timeout 5 ssh "${sshargs[@]}" 2>/dev/null "$host" \
|
||||||
fd "^\.git$" repos/ "${fdargs[@]}" -x printf "'ssh://%s/~/%q\n'" "'$host'" "'{//}'"
|
fd "^\.git$" repos/ "${fdargs[@]}" -L -x printf "'ssh://%s/~/%q\n'" "'$host'" "'{//}'"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
$spin xe <<<"$host" -j"$(wc -l <<<"$host")" -s "$(declare -f worker); worker \"\$@\"" 2>/dev/null ||:
|
$spin xe <<<"$host" -j"$(wc -l <<<"$host")" -s "$(declare -f worker); worker \"\$@\"" 2>/dev/null ||:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user