mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 15:30:40 +01:00
fix(ssh): allow multiple definitions per host (#12227)
This commit is contained in:
@@ -4,9 +4,16 @@
|
|||||||
# Filter out wildcard host sections.
|
# Filter out wildcard host sections.
|
||||||
_ssh_configfile="$HOME/.ssh/config"
|
_ssh_configfile="$HOME/.ssh/config"
|
||||||
if [[ -f "$_ssh_configfile" ]]; then
|
if [[ -f "$_ssh_configfile" ]]; then
|
||||||
_hosts=($(egrep '^Host.*' "$_ssh_configfile" | awk '{print $2}' | grep -v '^*' | sed -e 's/\.*\*$//'))
|
_ssh_hosts=($(
|
||||||
zstyle ':completion:*:hosts' hosts $_hosts
|
egrep '^Host.*' "$_ssh_configfile" |\
|
||||||
unset _hosts
|
awk '{for (i=2; i<=NF; i++) print $i}' |\
|
||||||
|
sort |\
|
||||||
|
uniq |\
|
||||||
|
grep -v '^*' |\
|
||||||
|
sed -e 's/\.*\*$//'
|
||||||
|
))
|
||||||
|
zstyle ':completion:*:hosts' hosts $_ssh_hosts
|
||||||
|
unset _ssh_hosts
|
||||||
fi
|
fi
|
||||||
unset _ssh_configfile
|
unset _ssh_configfile
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user