Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH _hosts: can complete hosts listed on ~/.ssh/config
- X-seq: zsh-workers 18334
- From: Tatsuki Sugiura <sugi@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH _hosts: can complete hosts listed on ~/.ssh/config
- Date: Tue, 11 Mar 2003 14:38:33 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author