about summary refs log tree commit diff
path: root/Completion/Unix/Command/_telnet
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-07-02 10:25:05 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-07-02 10:25:05 +0000
commit1cb11615aa337d98022a48c1c3c8c5c33b0b57c2 (patch)
tree666f075271d340fabcc63b564e1c296aa3715f9e /Completion/Unix/Command/_telnet
parentbedc4995d225195a2e48c0d9430ceb97adfb7e2f (diff)
downloadzsh-1cb11615aa337d98022a48c1c3c8c5c33b0b57c2.tar.gz
zsh-1cb11615aa337d98022a48c1c3c8c5c33b0b57c2.tar.xz
zsh-1cb11615aa337d98022a48c1c3c8c5c33b0b57c2.zip
merge changes back from 4.1
Diffstat (limited to 'Completion/Unix/Command/_telnet')
-rw-r--r--Completion/Unix/Command/_telnet73
1 files changed, 73 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_telnet b/Completion/Unix/Command/_telnet
new file mode 100644
index 000000000..5921105b0
--- /dev/null
+++ b/Completion/Unix/Command/_telnet
@@ -0,0 +1,73 @@
+#compdef telnet
+
+# Parameter used:
+#
+#  telnet_hosts_ports_users
+#    The array that contains 3-tuples `host:port:user'.
+
+local curcontext="$curcontext" state line expl ret=1
+typeset -A opt_args
+
+if (( ! $+_telnet_args )); then
+  local help="$(_call_program options telnet -\? < /dev/null 2>&1)"
+  local -A optionmap
+  optionmap=(
+    '*\[-8\]*' '-8[allow 8-Bit data]'
+    '*\[-E\]*' '-E[disable an escape character]'
+    '*\[-K\]*' '-K[no automatic login]'
+    '*\[-L\]*' '-L[allow 8-Bit data on output]'
+    '*\[-N\]*' '-N[suppress reverse lookup]'
+    '*\[-S tos\]*' '-S+:IP type-of-service:'
+    '*\[-X atype\]*' '-X+:authentication type to disable:'
+    '*\[-a\]*' '-a[attempt automatic login]'
+    '*\[-c\]*' '-c[disable .telnetrc]'
+    '*\[-d\]*' '-d[debug mode]'
+    '*\[-e char\]*' '-e+[specify escape character]:escape character:'
+    '*\[-f/*' '-f'
+    '*/-F\]*' '-F'
+    '*\[-k realm\]*' '-k+:realm:'
+    '*\[-l user\]*' '-l+[specify user]:user:->users'
+    '*\[-n tracefile\]*' '-n+[specify tracefile]:tracefile:_files'
+    '*\[-r\]*' '-r[rlogin like user interface]'
+    '*\[-s src_addr\]*' '-s+[set source IP address]:src_addr:'
+    '*\[-x\]*' '-x'
+    '*\[-t transcom\]*' '-t+:transcom:'
+    '*\[-noasynch\]*' '-noasynch'
+    '*\[-noasyncnet\]*' '-noasyncnet'
+    '*\[-noasynctty\]*' '-noasynctty'
+  )
+  _telnet_args=($optionmap[(K)"$help"])
+  (( $#_telnet_args )) || _telnet_args=( '-l+[specify user]:user:->users' )
+fi
+
+_arguments -C -s \
+  "$_telnet_args[@]" \
+  ':host:->hosts' \
+  ':port:->ports' && ret=0
+
+case "$state" in
+hosts)
+  _wanted hosts expl host \
+      _combination -s '[@:]' '' users-hosts-ports \
+          ${opt_args[-l]:+users=${opt_args[-l]:q}} \
+          hosts - && ret=0
+  ;;
+
+ports)
+  _wanted ports expl port \
+      _combination -s '[@:]' '' users-hosts-ports \
+          ${opt_args[-l]:+users=${opt_args[-l]:q}} \
+          hosts="${line[1]:q}" \
+          ports - && ret=0
+  ;;
+
+users)
+  _wanted users expl user \
+      _combination -s '[@:]' '' users-hosts-ports \
+      ${line[2]:+hosts="${line[2]:q}"} \
+      ${line[3]:+ports="${line[3]:q}"} \
+      users - && ret=0
+  ;;
+esac
+
+return ret