about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-19 01:02:15 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-19 01:02:15 +0000
commit2f7d80d79e65bd2ad54ba7af8211f635007438e8 (patch)
treedf939bb19f1e001b14e265b9fa1e3dd7fa55c79b
parent8534e7281e0ac5316fe8ca1b4f39ed236fef49b5 (diff)
downloadzsh-2f7d80d79e65bd2ad54ba7af8211f635007438e8.tar.gz
zsh-2f7d80d79e65bd2ad54ba7af8211f635007438e8.tar.xz
zsh-2f7d80d79e65bd2ad54ba7af8211f635007438e8.zip
zsh-workers/7934
-rw-r--r--Completion/User/_telnet82
1 files changed, 37 insertions, 45 deletions
diff --git a/Completion/User/_telnet b/Completion/User/_telnet
index 5c0a70da7..2895cc2af 100644
--- a/Completion/User/_telnet
+++ b/Completion/User/_telnet
@@ -9,55 +9,47 @@ local state line expl
 typeset -A options
 
 if (( ! $+_telnet_short )); then
-  local help="$(telnet -\? < /dev/null 2>&1)"
+  local k help="$(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[supress 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:' )
+
   _telnet_short=()
-  [[ "$help" = *"[-8]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-8[allow 8-Bit data]')
-  [[ "$help" = *"[-E]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-E[disable an escape character]')
-  [[ "$help" = *"[-K]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-K[no automatic login]')
-  [[ "$help" = *"[-L]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-L[allow 8-Bit data on output]')
-  [[ "$help" = *"[-N]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-N[supress reverse lookup]')
-  [[ "$help" = *"[-S tos]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-S+:IP type-of-service:')
-  [[ "$help" = *"[-X atype]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-X+:authentication type to disable:')
-  [[ "$help" = *"[-a]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-a[attempt automatic login]')
-  [[ "$help" = *"[-c]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-c[disable .telnetrc]')
-  [[ "$help" = *"[-d]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-d[debug mode]')
-  [[ "$help" = *"[-e char]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-e+[specify escape character]:escape character:')
-  [[ "$help" = *"[-f/-F]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-f' '-F')
-  [[ "$help" = *"[-k realm]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-k+:realm:')
-  [[ "$help" = *"[-l user]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-l+[specify user]:user:->users')
-  [[ "$help" = *"[-n tracefile]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-n+[specify tracefile]:tracefile:_files')
-  [[ "$help" = *"[-r]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-r[rlogin like user interface]')
-  [[ "$help" = *"[-s src_addr]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-s+[set source IP address]:src_addr:')
-  [[ "$help" = *"[-x]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-x')
-  [[ "$help" = *"[-t transcom]"* ]] &&
-    _telnet_short=("$_telnet_short[@]" '-t+:transcom:')
+  for k in ${(k)optionmap}
+  do
+    [[ "$help" = *"$k"* ]] &&
+      _telnet_short=( "$_telnet_short[@]" "$optionmap[$k]" )
+  done
 
   # _arguments cannot handle following three options.
+  optionmap=( "[-noasynch]" '-noasynch' \
+              "[-noasyncnet]" '-noasyncnet' \
+              "[-noasynctty]" '-noasynctty' )
+
   _telnet_long=()
-  [[ "$help" = *"[-noasynch]"* ]] &&
-    _telnet_long=("$_telnet_long[@]" '-noasynch')
-  [[ "$help" = *"[-noasyncnet]"* ]] &&
-    _telnet_long=("$_telnet_long[@]" '-noasyncnet')
-  [[ "$help" = *"[-noasynctty]"* ]] &&
-    _telnet_long=("$_telnet_long[@]" '-noasynctty')
+  for k in ${(k)optionmap}
+  do
+    [[ "$help" = *"$k"* ]] &&
+      _telnet_long=( "$_telnet_long[@]" "$optionmap[$k]" )
+  done
 fi
 
 [[ $#_telnet_long != 0 && (