From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10995 invoked from network); 11 Mar 2003 07:26:47 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Mar 2003 07:26:47 -0000 Received: (qmail 22898 invoked by alias); 11 Mar 2003 07:26:41 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18335 Received: (qmail 22891 invoked from network); 11 Mar 2003 07:26:41 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Mar 2003 07:26:41 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [192.35.17.14] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Mar 2003 7:26:41 -0000 Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.11.6/8.11.6) with ESMTP id h2B7QeN17820; Tue, 11 Mar 2003 08:26:40 +0100 (MET) Received: from MOWD019A.mow.siemens.ru ([163.242.196.119]) by mail2.siemens.de (8.11.6/8.11.6) with ESMTP id h2B7QdR16781; Tue, 11 Mar 2003 08:26:39 +0100 (MET) Received: by mowd019a.mow.siemens.ru with Internet Mail Service (5.5.2653.19) id ; Tue, 11 Mar 2003 10:28:55 +0300 Received: from mw2b210c (163.242.193.12 [163.242.193.12]) by MOWD019A.mow.siemens.ru with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id GWA4BNBH; Tue, 11 Mar 2003 10:28:49 +0300 From: Borzenkov Andrey To: "'Tatsuki Sugiura'" , zsh-workers@sunsite.dk Subject: RE: PATCH _hosts: can complete hosts listed on ~/.ssh/config Date: Tue, 11 Mar 2003 10:26:28 +0300 Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B66B@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal In-reply-to: <87r89eiht2.wl@nemui.org> > Hello. >=20 > Usually, "/etc/hosts" dos not contain hostname to wish to complete. > This pactch parse ~/.ssh/config and pick up hosts listed as "Host" > or "HostName". >=20 > What about this? >=20 I agree with idea but I do not like use of cache without revalidation. = Your code won't pick changes done after ~/.ssh/config has been first time = read. It is not the only place where (useful) revalidation is missing but = let's not introduce new one. Probably we need general purpose utility for cache variables without = backing store. Like saving mtime in __cache_sshconf_hosts_mtime and rechecking = it next time. Alternatively do not bother with caching at all. File is expected to be small enough so parsing it does not add significant overhead. -andrey > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- _hosts.orig 2003-03-11 14:21:35.000000000 +0900 > +++ _hosts 2003-03-11 14:22:54.000000000 +0900 > @@ -1,12 +1,15 @@ > -#compdef ftp ping rwho rup xping traceroute host aaaa zone mx ns soa = txt > +#compdef ftp ping rwho rup xping traceroute host aaaa zone mx ns soa = txt > mtr dnsip hping2 hping nmap tcptraceroute >=20 > local expl hosts >=20 > if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then > (( $+_cache_hosts )) || > : ${(A)_cache_hosts:=3D${(s: > = :)${(ps:\t:)${${(f)~~"$( + > + (( $+_cache_sshconf_hosts )) || > + : ${(A)_cache_sshconf_hosts:=3D${${${(M)${(s:# :)${(zj:# > :)${(Lf)"$([[ -f ~/.ssh/config ]] && = <~/.ssh/config)"}%%\#*}}##host(|name) > *}#host(|name) }/\*}} >=20 > - hosts=3D( "$_cache_hosts[@]" ) > + hosts=3D( "$_cache_hosts[@]" "$_cache_sshconf_hosts[@]") > fi >=20 > _wanted hosts expl host \ > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > -- > Tatsuki Sugiura mailto:sugi@nemui.org