From 47f20650b7b3238ef6374ece9fa74416a5e07c25 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Fri, 8 Sep 2023 15:27:39 -0700 Subject: [PATCH] zsh: busctl: fix flags parsing for properties I'm not quite sure what the original intent of this line was, but it doesn't work in the one call-site the "required" argument is actually used. The "writable" flag was indexed as a scalar leaving only the "e" to compare against. Instead, let's just sort the parsed flags and compare the whole thing. Also substitute "required" as a pattern, so that pattern based comparisons may be supported. --- shell-completion/zsh/_busctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell-completion/zsh/_busctl b/shell-completion/zsh/_busctl index b0cd4d5db51..70f9e740369 100644 --- a/shell-completion/zsh/_busctl +++ b/shell-completion/zsh/_busctl @@ -118,7 +118,7 @@ __dbus_matchspec() { __busctl introspect "$1" "$2" "$3" | while read NAME TYPE SIGNATURE VALUE FLAGS; do [[ -z "$member" || ${TYPE} == "$member" ]] && - [[ -z "$required" || ${${(s: :)FLAGS}[-1]} == "$required" ]] && + [[ -z "$required" || "${${(os: :)FLAGS}}" == $~required ]] && echo ${NAME#.} done } @@ -244,7 +244,7 @@ __dbus_matchspec() { ;; 5) _wanted property expl 'property' \ - compadd "$@" - $(_busctl_get_members $words[2,4] "property" "writable") + compadd "$@" - $(_busctl_get_members $words[2,4] "property" "*writable*") ;; 6) compadd "$@" - $(_busctl_get_signature $words[2,5])