]> err.no Git - dotfiles/commitdiff
Add support for debian.org hosts to tab completion too
authortfheen <tfheen@8da78d58-1cd3-0310-bee5-d77bd1b3e8bf>
Tue, 5 Jun 2012 15:25:53 +0000 (15:25 +0000)
committertfheen <tfheen@8da78d58-1cd3-0310-bee5-d77bd1b3e8bf>
Tue, 5 Jun 2012 15:25:53 +0000 (15:25 +0000)
git-svn-id: file:///svn/tfheen/trunk/dotfiles@1542 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf

zshfunc/update-debhosts [new file with mode: 0644]
zshrc

diff --git a/zshfunc/update-debhosts b/zshfunc/update-debhosts
new file mode 100644 (file)
index 0000000..dfd5f96
--- /dev/null
@@ -0,0 +1,10 @@
+# -*- sh -*-
+## vim:ft=zsh:foldmethod=marker
+
+(
+    printf "DEBHOSTS=( "
+    ldapsearch -ZZ -b dc=debian,dc=org -h db.debian.org -x '(host=*)' hostname | awk -F: '$1 == "hostname" {print $2}' | tr -d '\n'
+    printf ")\n"
+) > ~/.zshrc.d/60_debhosts
+
+. ~/.zshrc.d/60_debhosts
diff --git a/zshrc b/zshrc
index fd719d6dd584c2ee8e2be44e0a2dd88a6929d090..8e4fe033816ad910be74f71735bb6352fe48a7ed 100644 (file)
--- a/zshrc
+++ b/zshrc
@@ -191,8 +191,10 @@ unset paths
 # Don't beep.  Ever.
 setopt -B
 
+hosts=( $DEBHOSTS )
+
 if [ -e ~/.ssh/known_hosts ]; then
-    hosts=(`awk -F "[, ]" '{print $1}' ~/.ssh/known_hosts`)
+    hosts=($hosts `awk -F "[, ]" '{print $1}' ~/.ssh/known_hosts`)
 fi
 if [ -e ~/.ssh/known_hosts2 ]; then
     hosts=($hosts `awk -F "[, ]" '{print $1}' ~/.ssh/known_hosts2`)