about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_sysctl10
1 files changed, 9 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl
index 442953c4d..09995c98e 100644
--- a/Completion/Unix/Command/_sysctl
+++ b/Completion/Unix/Command/_sysctl
@@ -23,10 +23,18 @@ case $OSTYPE in
     else
       args=( ${args:#((#s)|*\))(\*|)--*} )	# remove long options
     fi
+    local delimiter=.
+    sysctlvars=( /proc/sys/**/*(.e*'REPLY=${REPLY#/proc/sys/}'*) )
+    if zstyle -t ":completion:${curcontext}:argument-rest" delimiter / || (( ${words[CURRENT][(Ie)/]} )); then
+      delimiter=/
+    else
+      sysctlvars=(${sysctlvars//\//.})
+    fi
+
     _arguments -S -A "-*" : $args \
       '(- :)'{-h,--help}'[display help text and exit]' \
       '(- :)'{-V,--version}'[display version info and exit]' \
-      '*:sysctl variable:_files -W /proc/sys'
+      "*:sysctl variable:_multi_parts -i -S = -q $delimiter sysctlvars"
   ;;
   freebsd<14->.*)
     args+=(