* Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion [not found] ` <20070623113320.GA25562@artemis.internal.dc7.debconf.org> @ 2007-06-24 11:57 ` Clint Adams 2007-06-24 19:44 ` Phil Pennock 0 siblings, 1 reply; 4+ messages in thread From: Clint Adams @ 2007-06-24 11:57 UTC (permalink / raw) To: Pierre Habouzit, 430146; +Cc: zsh-workers 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? Index: Completion/Unix/Type/_hosts =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_hosts,v retrieving revision 1.10 diff -u -r1.10 _hosts --- Completion/Unix/Type/_hosts 5 Apr 2006 10:04:32 -0000 1.10 +++ Completion/Unix/Type/_hosts 24 Jun 2007 11:52:08 -0000 @@ -48,6 +48,11 @@ _cache_hosts+=($khosts) fi done + + if zstyle -t ":completion:${curcontext}:hosts" use-ssh-config; then + [[ -r ~/.ssh/config ]] && _cache_hosts+=(${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**}) + fi + fi _hosts=( "$_cache_hosts[@]" ) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion 2007-06-24 11:57 ` Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion Clint Adams @ 2007-06-24 19:44 ` Phil Pennock 2007-06-25 14:32 ` Clint Adams 0 siblings, 1 reply; 4+ messages in thread From: Phil Pennock @ 2007-06-24 19:44 UTC (permalink / raw) To: zsh-workers; +Cc: Pierre Habouzit 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion 2007-06-24 19:44 ` Phil Pennock @ 2007-06-25 14:32 ` Clint Adams 2007-06-25 15:19 ` Peter Stephenson 0 siblings, 1 reply; 4+ messages in thread From: Clint Adams @ 2007-06-25 14:32 UTC (permalink / raw) To: zsh-workers, Pierre Habouzit On Sun, Jun 24, 2007 at 12:44:06PM -0700, Phil Pennock wrote: > 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. That sounds good. Is limiting it to ~/.ssh/config with a yes/no style too inflexible? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion 2007-06-25 14:32 ` Clint Adams @ 2007-06-25 15:19 ` Peter Stephenson 0 siblings, 0 replies; 4+ messages in thread From: Peter Stephenson @ 2007-06-25 15:19 UTC (permalink / raw) To: zsh-workers Clint Adams wrote: > That sounds good. Is limiting it to ~/.ssh/config with a yes/no style > too inflexible? It would probably nice to be able to configure the order in which it searched files and whether to stop when it found a match. You could do that if there tags ssh-config, ssh-hosts-global, ssh-hosts-local, although that doesn't fit will with the known-hosts-files. I'm not really sure what the best way of doing it is, but anyway you might have thought people would want to be able to search ~/.ssh/config before the global /etc/ssh/ssh_known_hosts. In practice this probably isn't a big issue. -- Peter Stephenson <pws@csr.com> Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-25 15:22 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [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 ` Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion Clint Adams 2007-06-24 19:44 ` Phil Pennock 2007-06-25 14:32 ` Clint Adams 2007-06-25 15:19 ` Peter Stephenson
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).