summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2001-07-06 11:22:13 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2001-07-06 11:22:13 +0000
commit13484584472e82505c9decd686bb67771af508c9 (patch)
tree54d885631c64f2b03443535ecbbe1504dc94edac
parentf2040baa9b457973da012405af7f600c72be85a7 (diff)
downloadzsh-13484584472e82505c9decd686bb67771af508c9.tar.gz
zsh-13484584472e82505c9decd686bb67771af508c9.tar.xz
zsh-13484584472e82505c9decd686bb67771af508c9.zip
add exclusion lists and use _multi_parts for sysctl completion on BSD (15252)
-rw-r--r--ChangeLog8
-rw-r--r--Completion/BSD/Command/_kld2
-rw-r--r--Completion/Unix/Command/_sysctl37
3 files changed, 28 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index c21e30555..5dad2875c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-06  Oliver Kiddle  <opk@zsh.org>
+
+	* 15252 (and Akinori Musha: 15245): Completion/BSD/Command/_kld,
+	Completion/Unix/Command/_sysctl: Add exclusion lists and use
+	_multi_parts for BSD completion of sysctl.
+
 2001-07-06  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 15283: Completion/Unix/Type/_path_files: when looking for
@@ -53,8 +59,6 @@
 	AC_SEARCH_LIBS for pcre.  Have pcre_match set positional
 	parameters with the contents of capture buffers.
 
-2001-07-03  Clint Adams  <clint@zsh.org>
-
 	* unposted: Doc/Makefile.in: add mod_pcre.yo to makefile.
 
 2001-07-03  Oliver Kiddle  <opk@zsh.org>
diff --git a/Completion/BSD/Command/_kld b/Completion/BSD/Command/_kld
index eefc8bf61..dd71f7a58 100644
--- a/Completion/BSD/Command/_kld
+++ b/Completion/BSD/Command/_kld
@@ -21,6 +21,8 @@ _kld_unload_id() {
 }
 
 _kld() {
+  unset _cache_sysctlvars
+
   case "$service" in
   kldload)
     _arguments -s \
diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl
index 4a2eaaf87..1ac0394e7 100644
--- a/Completion/Unix/Command/_sysctl
+++ b/Completion/Unix/Command/_sysctl
@@ -1,25 +1,28 @@
 #compdef sysctl
 
 case $OSTYPE in
-  freebsd[0-4]*)
-    _arguments -s \
-      '-a[list all]' \
-      '-A[show all opaques (values suppressed)]' \
-      '-b[binary output]' \
-      '-n[show only variable values]' \
-      '-w[write mode]' \
-      '-X[show all opaques (entire values)]' \
-      "*:sysctl variable:compadd ${words[(r)-w]:+-S =} $(sysctl -A | sed 's/:.*//')"
+  freebsd[0-4].*)
+    : ${(A)_cache_sysctlvars:=${${$(sysctl -A):#[^a-z]*}%%:*}}
+    _arguments -s -A "-*" \
+      '(-w -X *)-a[list all]' \
+      '(-w -X *)-A[show all opaques (values suppressed)]' \
+      '(-w)-b[binary output]' \
+      '(-w)-n[show only variable values]' \
+      '(-a -A -b -n -X)-w[write mode]' \
+      '(-a -A -w *)-X[show all opaques (entire values)]' \
+      '(-a -A -X)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
   ;;
-  freebsd[5-9]*)
-    _arguments -s \
-      '-a[list all]' \
+  freebsd[5-9].*)
+    local -a sysctlvars
+    sysctlvars=( $(sysctl -aN) )
+    _arguments -s -A "-*" \
+      '(*)-a[list all]' \
       '-b[binary output]' \
-      '-N[show only variable names]' \
-      '-n[show only variable values]' \
-      '-o[show opaques as well (values suppressed)]' \
-      '-x[show opaques as well (entire values)]' \
-      '*:sysctl variable:compadd -S "" - $(sysctl -aN)'
+      '(-n)-N[show only variable names]' \
+      '(-N)-n[show only variable values]' \
+      '(-x)-o[show opaques as well (values suppressed)]' \
+      '(-o)-x[show opaques as well (entire values)]' \
+      '(-a)*:sysctl variable:_multi_parts -i . sysctlvars'
   ;;
   linux*)
     _arguments -A "-*" \