about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
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