diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2000-05-23 18:06:32 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2000-05-23 18:06:32 +0000 |
commit | b9195aa57d0e2f9512450b169a807ff23b31def8 (patch) | |
tree | d252ccd479c0cf7d7a9f97a53f4f641b59ce30fe /Completion/User/_user_at_host | |
parent | 63b7b10355ebcb9543bcb8f2f40f173de66f0740 (diff) | |
download | zsh-b9195aa57d0e2f9512450b169a807ff23b31def8.tar.gz zsh-b9195aa57d0e2f9512450b169a807ff23b31def8.tar.xz zsh-b9195aa57d0e2f9512450b169a807ff23b31def8.zip |
minor completion fixes (11541)
Diffstat (limited to 'Completion/User/_user_at_host')
-rw-r--r-- | Completion/User/_user_at_host | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Completion/User/_user_at_host b/Completion/User/_user_at_host index 6006ef63b..b652242d3 100644 --- a/Completion/User/_user_at_host +++ b/Completion/User/_user_at_host @@ -1,15 +1,31 @@ #autoload -local expl nm="$compstate[nmatches]" +# 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 if [[ -prefix 1 *@ ]]; then - local user=${PREFIX/@} + local user=${PREFIX%%@*} + compset -P 1 '*@' - _description expl "hostnames for $user" - _combination accounts_users_hosts users="$user" hosts "$expl[@]" "$@" + + _wanted -C user-at hosts expl "host for $user" \ + _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" - else - _description expl "usernames" - _combination accounts_users_hosts users -S@ -q "$expl[@]" "$@" + compset -S '@*' || suf="@" + _wanted users expl "user" \ + _combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" - fi - -[[ nm -ne compstate[nmatches] ]] |