diff options
author | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-05-02 03:46:28 +0000 |
---|---|---|
committer | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-05-02 03:46:28 +0000 |
commit | 2598e0995abf3d3fadc226cbc282f25bfe8e6521 (patch) | |
tree | c26795f3890d32ad638e34030e83081603bb1cc7 /Completion/Unix/Type/_user_at_host | |
parent | 6a9a6a4fbce997fe53c6886791e5af794d79fd2f (diff) | |
download | zsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.tar.gz zsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.tar.xz zsh-2598e0995abf3d3fadc226cbc282f25bfe8e6521.zip |
Merge of workers/{21302,21306,21310}.
Diffstat (limited to 'Completion/Unix/Type/_user_at_host')
-rw-r--r-- | Completion/Unix/Type/_user_at_host | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_user_at_host b/Completion/Unix/Type/_user_at_host new file mode 100644 index 000000000..a242ddeb6 --- /dev/null +++ b/Completion/Unix/Type/_user_at_host @@ -0,0 +1,31 @@ +#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 expl 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%%@*} + + compset -P 1 '*@' + + _wanted -C user-at hosts expl "host for $user" \ + _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" - +else + compset -S '@*' || suf="@" + _wanted users expl "user" \ + _combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" - +fi |