about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2001-07-03 14:32:12 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2001-07-03 14:32:12 +0000
commite390c96bd667c442a6fc4e2f8f315a141a4c6a51 (patch)
tree1f141bae1668f3c37d8a0804f60332167642f1e0
parentad57c03213b3d163bcad7914fd0c7ec10e583d5d (diff)
downloadzsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.tar.gz
zsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.tar.xz
zsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.zip
add completion for sysctl(8) (15215, 15223)
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/.distfiles2
-rw-r--r--Completion/Unix/Command/_sysctl33
3 files changed, 40 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 76eba69b8..938f246f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-07-03  Oliver Kiddle  <opk@zsh.org>
+
+	* 15223, Akinori Musha: 15215: Completion/Unix/Command/.distfiles,
+	Completion/Unix/Command/_sysctl: Add completion for sysctl(8)
+
 2001-07-02  Clint Adams  <clint@zsh.org>
 
 	* unposted: Doc/Zsh/.distfiles,
@@ -17,7 +22,7 @@
 2001-07-02  Oliver Kiddle  <opk@zsh.org>
 
 	* 15204: zshconfig.ac, Src/compat.c, Src/params.c: fix compilation
-	problems on IRIX 5.2 and correct error messages
+	problems on IRIX 5.3 and correct error messages
 
 2001-07-02  Bart Schaefer  <schaefer@zsh.org>
 
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index c69eaeb01..7aaef9731 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -14,5 +14,5 @@ _cvs          _gnu_generic  _ls           _perl         _tar          _zip
 _dd           _gprof        _lynx         _perldoc      _telnet       _pine
 _dict         _grep         _lzop         _prcs         _tiff         _elm
 _diff         _gs           _make         _psutils      _tin	_apm  _mail
-_last         _loadkeys     _modutils     _ruby
+_last         _loadkeys     _modutils     _ruby         _sysctl
 '
diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl
new file mode 100644
index 000000000..4a2eaaf87
--- /dev/null
+++ b/Completion/Unix/Command/_sysctl
@@ -0,0 +1,33 @@
+#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[5-9]*)
+    _arguments -s \
+      '-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)'
+  ;;
+  linux*)
+    _arguments -A "-*" \
+      '-n[show only variable values]' \
+      '(-n -p -a -A)-w[write mode]' \
+      '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \
+      '(-n -w -p -A *)-a[list all]' \
+      '(-n -w -p -a *)-A[list all in table form]' \
+      '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys'
+  ;;
+esac