diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-22 12:29:47 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-22 12:29:47 +0000 |
commit | 3d9d13e918c195f974ff7b2f1dc5b65f6b20a441 (patch) | |
tree | d571aef9c8152287ed94dae1199108de80f0b984 /Completion/User/_user_at_host | |
parent | a76b36928c5cbeef3fe015ca30bbf910ab2a107e (diff) | |
download | zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.gz zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.tar.xz zsh-3d9d13e918c195f974ff7b2f1dc5b65f6b20a441.zip |
zsh-workers/8720
Diffstat (limited to 'Completion/User/_user_at_host')
-rw-r--r-- | Completion/User/_user_at_host | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Completion/User/_user_at_host b/Completion/User/_user_at_host index 78e5a12aa..1098d2342 100644 --- a/Completion/User/_user_at_host +++ b/Completion/User/_user_at_host @@ -1,13 +1,30 @@ #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/@} + local user=${PREFIX%%@*} compset -P 1 '*@' _wanted -C user-at hosts expl "host for $user" && - _combination accounts_users_hosts users="$user" hosts "$expl[@]" "$@" + _combination "${tag}" users-hosts users="$user" hosts "$expl[@]" "$@" else _wanted users expl "user" && - _combination accounts_users_hosts users -S@ -q "$expl[@]" "$@" + _combination "${tag}" users-hosts users -S@ -q "$expl[@]" "$@" fi |