[Pkg-zsh-commits] [zsh] 09/11: 32103: parse host:port format in ssh known_hosts files.
Axel Beckert
abe at deuxchevaux.org
Sun Dec 15 00:38:28 UTC 2013
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to branch upstream
in repository zsh.
commit 8ffba43be97e90be5753a90e3b5869450f108c79
Author: Aaron Peschel <aaron.peschel at gmail.com>
Date: Fri Dec 13 22:51:09 2013 -0800
32103: parse host:port format in ssh known_hosts files.
---
ChangeLog | 5 +++++
Completion/Unix/Type/_hosts | 15 +++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96dafe4..ae9c163 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-13 Barton E. Schaefer <schaefer at zsh.org>
+
+ * Aaron Peschel: 32103: Completion/Unix/Type/_hosts: parse
+ host:port format in ssh known_hosts files.
+
2013-12-10 Barton E. Schaefer <schaefer at zsh.org>
* 32099: Src/init.c: fix pointer declaration to avoid compile
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index 499caed..c3133dc 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -41,9 +41,20 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
for khostfile in $khostfiles; do
if [[ -r $khostfile ]]; then
- khosts=(${${(s:,:)${(j:,:)${(u)${(f)"$(<$khostfile)"}%%[ |#]*}}}:#*[\[\]]*})
+ khosts=(${(s/,/j/,/u)${(f)"$(<$khostfile)"}%%[ |#]*})
+
+ # known_hosts syntax supports the host being in the form [hostname]:port
+ # The filter below extracts the hostname from lines using this format.
+ khosts=($(for host ($khosts); do
+ if [[ $host =~ "\[(.*)\]:\d*" ]]; then
+ echo $match
+ else
+ echo $host
+ fi
+ done))
+
if [[ -z $useip ]]; then
- khosts=(${${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}:#*[\[\]]*})
+ khosts=(${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)})
fi
_cache_hosts+=($khosts)
fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git
More information about the Pkg-zsh-commits
mailing list