zsh-workers
 help / color / mirror / code / Atom feed
7e40f3fa770ea8d99b831666f91b4cdcf533a178 blob 1315 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
#autoload

local -a config_hosts
local config
integer ind

# If it looks like a path, it's not a host for our purposes, abort early so
# that combined path+host matching can more efficiently deal with local
# paths.
case "$PREFIX" in
  ( /* | ./* )
    return
    ;;
esac

# If users-hosts matches, we shouldn't complete anything else.
if [[ "$IPREFIX" == *@ ]]; then
  _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
else
  _combination -s '[:@]' my-accounts users-hosts \
    ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return
fi
if (( ind = ${words[(I)-F]} )); then
  config=${~words[ind+1]} 2>/dev/null
else
  config="$HOME/.ssh/config"
fi
if [[ -r $config ]]; then
  local key line host
  local -a lines=("${(@f)$(<"$config")}") 2>/dev/null
  while (($#lines)); do
    IFS=$'=\t ' read -r key line <<<"${lines[1]}"
    case "$key" in
    ((#i)include)
      lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;
    ((#i)host(|name))
      for host in ${(z)line}; do
	case $host in
	(*[*?]*) ;;
	(*) config_hosts+=("$host") ;;
	esac
      done ;&
    (*) shift lines;;
    esac
  done
  if (( ${#config_hosts} )); then
    _wanted hosts expl 'remote host name' \
      compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
  fi
fi
debug log:

solving 7e40f3fa7 ...
found 7e40f3fa7 in https://inbox.vuxu.org/zsh-workers/20190527233331.GA84827@phil-pennock/
found e20142cfd in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 e20142cfd2d47d56c3957deaaaf95148bc11847c	Completion/Unix/Type/_ssh_hosts

applying [1/1] https://inbox.vuxu.org/zsh-workers/20190527233331.GA84827@phil-pennock/
diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts
index e20142cfd..7e40f3fa7 100644

Checking patch Completion/Unix/Type/_ssh_hosts...
Applied patch Completion/Unix/Type/_ssh_hosts cleanly.

index at:
100644 7e40f3fa770ea8d99b831666f91b4cdcf533a178	Completion/Unix/Type/_ssh_hosts

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).