about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-12 03:38:15 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-12 03:38:15 +0000
commite644c39ba1688c6b9c30afc86e4bf25a8bd47d3c (patch)
tree8d9bb4274b4c5df3f8bc41a2ce1a108c87dd54a1 /Completion/User
parent189116eac0f70862330cb9a6e49a7a85474ea7fa (diff)
downloadzsh-e644c39ba1688c6b9c30afc86e4bf25a8bd47d3c.tar.gz
zsh-e644c39ba1688c6b9c30afc86e4bf25a8bd47d3c.tar.xz
zsh-e644c39ba1688c6b9c30afc86e4bf25a8bd47d3c.zip
zsh-workers/7781
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/_hosts2
-rw-r--r--Completion/User/_socket19
-rw-r--r--Completion/User/_telnet10
3 files changed, 24 insertions, 7 deletions
diff --git a/Completion/User/_hosts b/Completion/User/_hosts
index 2ea5169cb..9f5a39cca 100644
--- a/Completion/User/_hosts
+++ b/Completion/User/_hosts
@@ -5,4 +5,4 @@ local expl
 : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
 
 _description expl host
-compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "${hosts[@]%:*}"
+compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]"
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
diff --git a/Completion/User/_telnet b/Completion/User/_telnet
index 54d9a0a2d..594dcf2e5 100644
--- a/Completion/User/_telnet
+++ b/Completion/User/_telnet
@@ -1,5 +1,11 @@
 #compdef telnet
 
+# Parameter used:
+#
+#  telnet_ports
+#    The associative array that maps a host name to a space-separated list of
+#    ports.
+
 _arguments -s \
   -{F,f,x} \
   '-8[allow 8-Bit data]' \
@@ -16,6 +22,6 @@ _arguments -s \
   '-l+[specify user]:user:' \
   '-n+[specify tracefile]:tracefile:_files' \
   '-r[rlogin like user interface]' \
-  ':host:_hosts' \
-  ':port:{ _hostports $line[2] "$expl[@]" }'
+  ':host:{ compadd "$expl[@]" - ${(k)telnet_ports} || _hosts "$expl[@]" }' \
+  ':port:{ if (( $+telnet_ports )); then compadd "$expl[@]" - ${=telnet_ports[$line[2]]}; else _message "port"; fi }'