26763: fix problem on failed cd -s to relative path
[zsh.git] / Completion / Unix / Type / _user_at_host
bloba242ddeb62a65bc2c81aa1dd3486997508a2c707
1 #autoload
3 # Complete user/host combinations. Normally this looks for the style
4 # `users-hosts' for the tag `accounts'. A different tag may be given
5 # with `-t tag'.
6 # A `-' or `--' as the first argument is ignored.
8 local expl suf tag=accounts
10 if [[ "$1" = -t?* ]]; then
11   tag="${1[3,-1]}"
12   shift
13 elif [[ "$1" = -t ]]; then
14   tag="$2"
15   shift 2
18 [[ "$1" = -(|-) ]] && shift
20 if [[ -prefix 1 *@ ]]; then
21   local user=${PREFIX%%@*}
23   compset -P 1 '*@'
25   _wanted -C user-at hosts expl "host for $user" \
26       _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" -
27 else
28   compset -S '@*' || suf="@"
29   _wanted users expl "user" \
30       _combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" -