zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: <zsh-workers@sunsite.auc.dk>
Subject: Re: PATCH: _hosts, _hostports, _telnet and _socket
Date: Sun, 19 Sep 1999 00:49:29 +0000	[thread overview]
Message-ID: <990919004929.ZM6808@candle.brasslantern.com> (raw)
In-Reply-To: <rsqaeqm73t4.fsf@crane.jaist.ac.jp>

On Sep 17,  9:57am, Tanaka Akira wrote:
} Subject: Re: PATCH: _hosts, _hostports, _telnet and _socket
}
} In article <rsqvh9g8gf2.fsf@crane.jaist.ac.jp>,
}   Tanaka Akira <akr@jaist.ac.jp> writes:
} 
} > I agree that `telnet' has many variants and `_telnet' should complete
} > only valid options of `telnet' if it is possible.
} 
} Following patch tries this.

A minor improvement ...

Index: Completion/User/_telnet
===================================================================
@@ -9,55 +9,47 @@
 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 && (

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-09-19  0:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-12  0:00 Tanaka Akira
1999-09-12  2:20 ` Bart Schaefer
1999-09-12  3:36   ` Tanaka Akira
1999-09-12 21:25     ` Adam Spiers
1999-09-13 14:06       ` Clint Adams
1999-09-13  9:09     ` Peter Stephenson
1999-09-13 18:20       ` Tanaka Akira
1999-09-14 14:25       ` Clint Adams
1999-09-12 11:26 ` Andrej Borsenkow
1999-09-12 12:26   ` Tanaka Akira
1999-09-17  0:57     ` Tanaka Akira
1999-09-19  0:49       ` Bart Schaefer [this message]
1999-09-14  8:34 Sven Wischnowsky
1999-09-15 12:56 ` Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990919004929.ZM6808@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).