1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-20 03:51:07 +02:00
zsh/Completion/User/_user_at_host
2000-03-23 04:19:26 +00:00

30 lines
685 B
Text

#autoload
# 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 tag=accounts
if [[ "$1" = -t?* ]]; then
tag="${1[3,-1]}"
shift
elif [[ "$1" = -t ]]; then
tag="$2"
shift 2
fi
[[ "$1" = -(|-) ]] && shift
if [[ -prefix 1 *@ ]]; then
local user=${PREFIX%%@*}
compset -P 1 '*@'
_wanted -C user-at hosts expl "host for $user" \
_combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" -
else
_wanted users expl "user" \
_combination -s '[:@]' "${tag}" users-hosts users -S@ -q "$@" -
fi