about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:37:24 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:37:24 +0000
commit6e81cd8a168c5ba033947ea2464c3c3e7aa794c9 (patch)
treedf379015396ce753651bb3c6ee252e570372df5c
parent004a5b240dfce5fc907454d9f3ae18c430888dc6 (diff)
downloadzsh-6e81cd8a168c5ba033947ea2464c3c3e7aa794c9.tar.gz
zsh-6e81cd8a168c5ba033947ea2464c3c3e7aa794c9.tar.xz
zsh-6e81cd8a168c5ba033947ea2464c3c3e7aa794c9.zip
moved from Completion/User/_domains
-rw-r--r--Completion/Unix/Type/_domains20
1 files changed, 20 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_domains b/Completion/Unix/Type/_domains
new file mode 100644
index 000000000..42a0966dd
--- /dev/null
+++ b/Completion/Unix/Type/_domains
@@ -0,0 +1,20 @@
+#autoload
+
+local expl domains tmp
+
+if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then
+  if (( ! $+_cache_domains )); then
+    _cache_domains=()
+    if [[ -f /etc/resolv.conf ]]; then
+      while read tmp; do
+        [[ "$tmp" = (domain|search)* ]] &&
+            _cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ 	]#}#*[ 	]}" )
+      done < /etc/resolv.conf
+      _cache_domains=( "${(@)_cache_domains:#[ 	]#}" )
+    fi
+  fi
+  domains=( "$_cache_domains[@]" )
+fi
+
+_wanted domains expl domain \
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains