1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-25 17:20:25 +02:00

github #50: Complete hosts in "Match" directive

This commit is contained in:
SATOH Fumiyasu 2020-03-08 16:10:45 +09:00 committed by Oliver Kiddle
parent dc8061ebe4
commit a0a27473fe
2 changed files with 15 additions and 0 deletions

View file

@ -19,8 +19,20 @@ fi
if [[ -r $config ]]; then
local key line host
local -a lines=("${(@f)$(<"$config")}") 2>/dev/null
local -a match_args
while (($#lines)); do
IFS=$'=\t ' read -r key line <<<"${lines[1]}"
if [[ "$key" == ((#i)match) ]]; then
match_args=(${(z)line})
while [[ $#match_args -ge 2 ]]; do
if [[ "${match_args[1]}" == (#i)(canonical|final|(|original)host) ]]; then
key="Host"
line="${match_args[2]//,/ }"
break
fi
shift 2 match_args
done
fi
case "$key" in
((#i)include)
lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;