From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12217 invoked from network); 17 Sep 1999 00:57:45 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Sep 1999 00:57:45 -0000 Received: (qmail 26357 invoked by alias); 17 Sep 1999 00:57:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7887 Received: (qmail 26350 invoked from network); 17 Sep 1999 00:57:32 -0000 To: Subject: Re: PATCH: _hosts, _hostports, _telnet and _socket References: <000001befd11$ba0b0bb0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 (generated by AKEMI 1.13.2 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCQTA0Y0s8GyhCIg==?=) Content-Type: text/plain; charset=US-ASCII From: Tanaka Akira Date: 17 Sep 1999 09:57:27 +0900 In-Reply-To: Tanaka Akira's message of "12 Sep 1999 21:26:09 +0900" Message-ID: User-Agent: Chao-gnus/6.12.5 AKEMI/1.13.2 (=?ISO-2022-JP?B?GyRCQTAbKEI=?= =?ISO-2022-JP?B?GyRCNGNLPBsoQg==?=) FLAM-DOODLE/1.12.6 (=?ISO-2022-JP?B?GyRCM3cbKEI=?= 10R4.0/5.0) Emacs/20.4 (sparc-sun-solaris2.6) MULE/4.0 (HANANOEN) In article , Tanaka Akira 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. Index: Completion/User/_telnet =================================================================== RCS file: /projects/zsh/zsh/Completion/User/_telnet,v retrieving revision 1.1.1.3 diff -u -F^( -r1.1.1.3 _telnet --- _telnet 1999/09/13 18:22:22 1.1.1.3 +++ _telnet 1999/09/17 00:50:42 @@ -8,22 +8,68 @@ local state line expl typeset -A options +if (( ! $+_telnet_short )); then + local help="$(telnet -\? < /dev/null 2>&1)" + _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:') + + # _arguments cannot handle following three options. + _telnet_long=() + [[ "$help" = *"[-noasynch]"* ]] && + _telnet_long=("$_telnet_long[@]" '-noasynch') + [[ "$help" = *"[-noasyncnet]"* ]] && + _telnet_long=("$_telnet_long[@]" '-noasyncnet') + [[ "$help" = *"[-noasynctty]"* ]] && + _telnet_long=("$_telnet_long[@]" '-noasynctty') +fi + +[[ $#_telnet_long != 0 && ( + -z "$compconfig[option_prefix]" || + "$compconfig[option_prefix]" = *\!${words[1]}* || + "$PREFIX" = [-+]* ) ]] && { + _description expl 'option' + _describe -o option _telnet_long "$expl[@]" +} + _arguments -s \ - -{F,f,x} \ - '-8[allow 8-Bit data]' \ - '-E[disable an escape character]' \ - '-K[no automatic login]' \ - '-L[allow 8-Bit data on output]' \ - '-S+:IP type-of-service:' \ - '-X+:authentication type to disable:' \ - '-a[attempt automatic login]' \ - '-c[disable .telnetrc]' \ - '-d[debug mode]' \ - '-e+[specify escape character]:escape character:' \ - '-k+:realm:' \ - '-l+[specify user]:user:->users' \ - '-n+[specify tracefile]:tracefile:_files' \ - '-r[rlogin like user interface]' \ + "$_telnet_short[@]" \ ':host:->hosts' \ ':port:->ports' -- Tanaka Akira