From e644c39ba1688c6b9c30afc86e4bf25a8bd47d3c Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 12 Sep 1999 03:38:15 +0000 Subject: zsh-workers/7781 --- Completion/User/_socket | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Completion/User/_socket') diff --git a/Completion/User/_socket b/Completion/User/_socket index 353a66fd5..c7605a1ac 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -1,5 +1,12 @@ #compdef socket +# Parameter used: +# +# socket_ports +# The associative array that maps a host name to a space-separated list of +# ports. + + local state line expl typeset -A options @@ -18,17 +25,21 @@ command) arg1) if (( $+options[-s] )); then - _message 'port' + _message 'port to listen' else _description expl 'host' - _hosts "$expl[@]" + compadd "$expl[@]" - ${(k)socket_ports} || _hosts "$expl[@]" fi ;; arg2) if (( ! $+options[-s] )); then - _description expl 'port' - _hostports $line[2] "$expl[@]" + _description expl 'port to connect' + if (( $+socket_ports )); then + compadd "$expl[@]" - ${=socket_ports[$line[2]]}; + else + _message 'port to connect'; + fi fi ;; esac -- cgit 1.4.1