summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-02-03 22:44:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-02-03 22:44:49 +0000
commitdfea4c5eaa685ba8c7bff59dff5243ed5f428bf1 (patch)
treeca3e2c756c1fc7dd444f3725f5ad30573406d155
parented6c05aa7cccd69d4928907450f5d6d84d3ef287 (diff)
downloadzsh-dfea4c5eaa685ba8c7bff59dff5243ed5f428bf1.tar.gz
zsh-dfea4c5eaa685ba8c7bff59dff5243ed5f428bf1.tar.xz
zsh-dfea4c5eaa685ba8c7bff59dff5243ed5f428bf1.zip
22191: from Danek Duvall: neaten host and user completions
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Type/_hosts2
-rw-r--r--Completion/Unix/Type/_users6
3 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c16ded93..b6d58ef56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-03  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 22191: from Danek Duvall: Completion/Unix/Type/_hosts,
+	Completion/Unix/Type/_users: neaten _hosts and make _users
+	more consistent.
+
 2006-02-03  Peter Stephenson  <pws@csr.com>
 
 	* 22187: Completion/Unix/Type/_hosts: don't trounce any global
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index e6833132f..7d88a4532 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -23,7 +23,7 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
     fi
 
     if [[ -r ~/.ssh/known_hosts ]]; then
-      _cache_hosts+=( $(sed -e '/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]/d' -e 's/[ ,].*//p' ~/.ssh/known_hosts) )
+      _cache_hosts+=(${${${(u)${(f)"$(<~/.ssh/known_hosts)"}%%[ ,]*}:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)})
     fi
   fi
 
diff --git a/Completion/Unix/Type/_users b/Completion/Unix/Type/_users
index de671f27d..5ab8dbc55 100644
--- a/Completion/Unix/Type/_users
+++ b/Completion/Unix/Type/_users
@@ -2,7 +2,9 @@
 
 local expl users
 
-zstyle -a ":completion:${curcontext}:" users users &&
-    _wanted users expl user compadd "$@" -a - users && return 0
+if zstyle -a ":completion:${curcontext}:users" users users; then
+    _wanted users expl user compadd "$@" -a - users
+    return 0
+fi
 
 _wanted users expl user compadd "$@" -k - userdirs