zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: add user control of hosts to complete
@ 1999-09-17  2:46 Adam Spiers
  1999-09-17  7:51 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 1999-09-17  2:46 UTC (permalink / raw)
  To: zsh workers mailing list

Hope this one's OK.

Index: Completion/User/_hosts
===================================================================
RCS file: /usr/local/cvsroot/zsh/Completion/User/_hosts,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _hosts
--- Completion/User/_hosts	1999/09/16 11:39:44	1.1.1.3
+++ Completion/User/_hosts	1999/09/17 00:44:47
@@ -4,5 +4,8 @@
 
 : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
 
+# Let the user add her own hosts in if she wants
+hosts=( $hostnames $hosts )
+
 _description expl host
 compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$hosts[@]"


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: add user control of hosts to complete
  1999-09-17  2:46 PATCH: add user control of hosts to complete Adam Spiers
@ 1999-09-17  7:51 ` Peter Stephenson
  1999-09-17 11:10   ` Adam Spiers
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 1999-09-17  7:51 UTC (permalink / raw)
  To: zsh workers mailing list

Adam Spiers wrote:
>  : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^
> [:blank:]]#}}}
>  
> +# Let the user add her own hosts in if she wants
> +hosts=( $hostnames $hosts )

As Sven already pointed out, $hosts is there for the user to set. It sets
its own defaults as a last gasp if it's empty.  If you do have your own
hosts, the contents of /etc/hosts may be simply noise. I don't think we
need a separate variable.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: add user control of hosts to complete
  1999-09-17  7:51 ` Peter Stephenson
@ 1999-09-17 11:10   ` Adam Spiers
  0 siblings, 0 replies; 4+ messages in thread
From: Adam Spiers @ 1999-09-17 11:10 UTC (permalink / raw)
  To: zsh workers mailing list

Peter Stephenson (pws@ibmth.df.unipi.it) wrote:
> Adam Spiers wrote:
> >  : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^
> > [:blank:]]#}}}
> >  
> > +# Let the user add her own hosts in if she wants
> > +hosts=( $hostnames $hosts )
> 
> As Sven already pointed out, $hosts is there for the user to set. It sets
> its own defaults as a last gasp if it's empty.  If you do have your own
> hosts, the contents of /etc/hosts may be simply noise. I don't think we
> need a separate variable.

Ack, sorry about that.  My brain tends to switch off when I look at
horrendously obfuscated rats-dropping-core lines.  OTOH, I do quite
like the idea of having the choice of merging /etc/hosts in with the
user-defined ones, but then I guess the user can just redefine _hosts
for that.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: add user control of hosts to complete
@ 1999-09-17  7:35 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-09-17  7:35 UTC (permalink / raw)
  To: zsh-workers


Adam Spiers wrote:

> Hope this one's OK.
> 
> ...
>  
>  : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}

Hm, this assignment already makes the value the user set `hosts' to
take precedence...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-09-17 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-17  2:46 PATCH: add user control of hosts to complete Adam Spiers
1999-09-17  7:51 ` Peter Stephenson
1999-09-17 11:10   ` Adam Spiers
1999-09-17  7:35 Sven Wischnowsky

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).