Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _sysctl pattern fails for FreeBSD 10



With FreeBSD 10.x, $OSTYPE doesn't match the [5-9] part any more.
Also, it seems wise to fall back on default completion if we can't do
better. There's a lot of newer options that aren't completed but this
doesn't fix that.

Oliver

diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl
index 36b579b..ff3312f 100644
--- a/Completion/Unix/Command/_sysctl
+++ b/Completion/Unix/Command/_sysctl
@@ -1,9 +1,9 @@
 #compdef sysctl
 
 case $OSTYPE in
-  *freebsd[5-9].*|freebsd4.[4-9]*)
+  *freebsd<5->.*|freebsd4.[4-9]*)
     local -a sysctlvars
-    sysctlvars=( $(sysctl -aN) )
+    sysctlvars=( $(_call_program sysctl-variables sysctl -aN) )
     _arguments -s -A "-*" \
       '(*)-a[list all]' \
       '-b[binary output]' \
@@ -41,5 +41,8 @@ case $OSTYPE in
       '(-w)-n[show only values]' \
       '(-a -A -n)-w[write variable]' \
       '(-a -A)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
-    ;;
+  ;;
+  *)
+    _default
+  ;;
 esac



Messages sorted by: Reverse Date, Date, Thread, Author