1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-04 01:41:18 +02:00
zsh/Completion/User/_user_at_host

32 lines
724 B
Plaintext
Raw Normal View History

1999-09-30 01:00:20 +02:00
#autoload
2000-05-23 20:06:32 +02:00
# Complete user/host combinations. Normally this looks for the style
# `users-hosts' for the tag `accounts'. A different tag may be given
# with `-t tag'.
# A `-' or `--' as the first argument is ignored.
local suf tag=accounts
if [[ "$1" = -t?* ]]; then
tag="${1[3,-1]}"
shift
elif [[ "$1" = -t ]]; then
tag="$2"
shift 2
fi
[[ "$1" = -(|-) ]] && shift
1999-09-30 01:00:20 +02:00
if [[ -prefix 1 *@ ]]; then
2000-05-23 20:06:32 +02:00
local user=${PREFIX%%@*}
1999-09-30 01:00:20 +02:00
compset -P 1 '*@'
2000-05-23 20:06:32 +02:00
_wanted -C user-at hosts expl "host for $user" \
_combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" -
1999-09-30 01:00:20 +02:00
else
2000-05-23 20:06:32 +02:00
compset -S '@*' || suf="@"
_wanted users expl "user" \
_combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" -
1999-09-30 01:00:20 +02:00
fi