about summary refs log tree commit diff
path: root/Completion/Unix/Command
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 /Completion/Unix/Command
parentad57c03213b3d163bcad7914fd0c7ec10e583d5d (diff)
downloadzsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.tar.gz
zsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.tar.xz
zsh-e390c96bd667c442a6fc4e2f8f315a141a4c6a51.zip
add completion for sysctl(8) (15215, 15223)
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/.distfiles2
-rw-r--r--Completion/Unix/Command/_sysctl33
2 files changed, 34 insertions, 1 deletions
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