+# Host completion for SSH known hosts.
+function _known_hosts() {
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ HOSTS=$(sed 's/[ ].*//;s/,/\n/' ~/.ssh/known_hosts)
+
+ COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
+ return 0
+}
+
+# Host completion from dsh groups.
+function _dshgroup() {
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ HOSTS=$(grep -rh '^[A-Za-z0-9]' ~/.dsh/group)
+
+ COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
+ return 0
+}
+
+function _omnissh() {
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ HOSTS="$(grep -rh '^[A-Za-z0-9]' ~/.dsh/group)
+$(sed 's/[ ].*//;s/,/\n/' ~/.ssh/known_hosts)
+$(find $COMPLETION_DIR_SSH -type f -perm -100 2>/dev/null | sed 's@.*/@@')"
+
+ COMPREPLY=($(compgen -W "$HOSTS" -- "$cur"))
+ return 0
+}
+