about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Cook <illua@users.sourceforge.net>2024-11-11 09:27:52 -0500
committerEric Cook <illua@users.sourceforge.net>2024-11-11 09:27:52 -0500
commit9b8af0900fd8167543e5786b46e70d3f32d45e2b (patch)
tree206a7ca2da1f3947b6b95191a98b1593f4664372
parentf282ff579284c7dd918438bc8e30fba4f6776c8c (diff)
downloadzsh-9b8af0900fd8167543e5786b46e70d3f32d45e2b.tar.gz
zsh-9b8af0900fd8167543e5786b46e70d3f32d45e2b.tar.xz
zsh-9b8af0900fd8167543e5786b46e70d3f32d45e2b.zip
53144: _sysctl: support completion with the dot delimiter on linux
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_sysctl10
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 35b01f95e..a0e742244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-11-11  Eric Cook  <llua@gmx.com>
+
+	* 53144: Completion/Unix/Command/_sysctl:
+	support completion with the dot delimiter on linux
+
 2024-11-05  Bart Schaefer  <schaefer@toltec-ubuntu>
 
 	* 53209 + comments + test: Src/params.c, Test/D04parameter.ztst:
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+=(