zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@sunsite.dk
Cc: Pierre Habouzit <madcoder@debian.org>
Subject: Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion
Date: Sun, 24 Jun 2007 12:44:06 -0700	[thread overview]
Message-ID: <20070624194406.GA73513@redoubt.spodhuis.org> (raw)
In-Reply-To: <20070624115727.GA31510@scowler.net>

On 2007-06-24 at 07:57 -0400, Clint Adams wrote:
> On Sat, Jun 23, 2007 at 12:33:21PM +0100, Pierre Habouzit wrote:
> >   Anyways, I'm not using it anymore because I fancy the
> > .ssh/known_hosts more, but I miss it :)
> 
> We could do something like this to generate matches from ~/.ssh/config .
> Anyone have better ideas?

The Hosts lines in .ssh/config are glob patterns.  Both '*' and '?' are
valid characters.  With farms of machines under a consistent naming
scheme, this comes into play.

Further, multiple patterns can be on the same line, so you can have
hostnames and patterns.  I look at my config now ... ugh.  Way to make
things bad: have a section of your ~/.ssh/config delimited by magic
comments used by another script when generating an updated config file.

> +    if zstyle -t ":completion:${curcontext}:hosts" use-ssh-config; then
> +      [[ -r ~/.ssh/config ]] && _cache_hosts+=(${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**})
> +    fi

I think that:
 ${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**}
should be:
 ${${=${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*[\*\?]*}

This splits on $IFS earlier so that the outer :# filter applies on a
per-item basis instead of per-line, and adds '?' to the filter pattern.

And people wonder why I laugh when they describe _Perl_ as a line-noise
language.  ;-)

Regards,
-Phil


  reply	other threads:[~2007-06-24 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070622180648.14337.68045.reportbug@localhost>
     [not found] ` <20070622211507.GA16349@scowler.net>
     [not found]   ` <20070622222216.GA9656@artemis.internal.dc7.debconf.org>
     [not found]     ` <20070623074721.GA28769@scowler.net>
     [not found]       ` <20070623113320.GA25562@artemis.internal.dc7.debconf.org>
2007-06-24 11:57         ` Clint Adams
2007-06-24 19:44           ` Phil Pennock [this message]
2007-06-25 14:32             ` Clint Adams
2007-06-25 15:19               ` Peter Stephenson

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=20070624194406.GA73513@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=madcoder@debian.org \
    --cc=zsh-workers@sunsite.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).