Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _hosts



On Fri, Feb 03, 2006 at 10:40:45PM +0000, Peter Stephenson wrote:

> > Is there some reason that _hosts uses the hosts tag, but _users doesn't use
> > the users tag?
> 
> I think it must be an oversight, given that the manual specifically
> mentions the existence of a users tag (as well as a users style).

Yup.  Though changing it now will break anyone who had it working with a
style with an empty tag.

> I'll commit the following...

Cool, thanks.  Just one nitty change:

> Index: Completion/Unix/Type/_hosts
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_hosts,v
> retrieving revision 1.6
> diff -u -r1.6 _hosts
> --- Completion/Unix/Type/_hosts	3 Feb 2006 16:32:15 -0000	1.6
> +++ Completion/Unix/Type/_hosts	3 Feb 2006 22:34:33 -0000
> @@ -23,7 +23,7 @@
>      fi
>  
>      if [[ -r ~/.ssh/known_hosts ]]; then
> -      _cache_hosts+=( $(sed -e '/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]/d' -e 's/[ ,].*//p' ~/.ssh/known_hosts) )
> +      _cache_hosts+=(${${${(u)${(f)"$(<~/.ssh/known_hosts)"}%%[ ,]*}:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)})
  +      _cache_hosts+=(${${${(u)${(f)"$(<~/.ssh/known_hosts)"}%%[ ,#]*}:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)})

That is, remove everything after the first # as well, since the file can
have comments like that.

Thanks,
Danek



Messages sorted by: Reverse Date, Date, Thread, Author