From 5af07c76cabe919de61ee09bd65b6a54ec163b85 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 2 Apr 2001 11:43:27 +0000 Subject: moved from Completion/User/_user_at_host --- Completion/Unix/Type/_user_at_host | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Completion/Unix/Type/_user_at_host diff --git a/Completion/Unix/Type/_user_at_host b/Completion/Unix/Type/_user_at_host new file mode 100644 index 000000000..b652242d3 --- /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 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 -- cgit 1.4.1