From: Tatsuki Sugiura <sugi@nemui.org>
To: zsh-workers@sunsite.dk
Subject: PATCH _hosts: can complete hosts listed on ~/.ssh/config
Date: Tue, 11 Mar 2003 14:38:33 +0900 [thread overview]
Message-ID: <87r89eiht2.wl@nemui.org> (raw)
Hello.
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".
What about this?
==============
--- _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
local expl hosts
if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
(( $+_cache_hosts )) ||
: ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
+
+ (( $+_cache_sshconf_hosts )) ||
+ : ${(A)_cache_sshconf_hosts:=${${${(M)${(s:# :)${(zj:# :)${(Lf)"$([[ -f ~/.ssh/config ]] && <~/.ssh/config)"}%%\#*}}##host(|name) *}#host(|name) }/\*}}
- hosts=( "$_cache_hosts[@]" )
+ hosts=( "$_cache_hosts[@]" "$_cache_sshconf_hosts[@]")
fi
_wanted hosts expl host \
==============
--
Tatsuki Sugiura mailto:sugi@nemui.org
next reply other threads:[~2003-03-11 5:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-11 5:38 Tatsuki Sugiura [this message]
2003-03-11 7:26 ` Borzenkov Andrey
2003-03-11 13:53 ` Oliver Kiddle
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=87r89eiht2.wl@nemui.org \
--to=sugi@nemui.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).