1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00

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.
This commit is contained in:
Ronan Pigott 2023-09-08 15:27:39 -07:00 committed by Luca Boccassi
parent 7b9da3861a
commit 47f20650b7

View File

@ -118,7 +118,7 @@ __dbus_matchspec() {
__busctl introspect "$1" "$2" "$3" | __busctl introspect "$1" "$2" "$3" |
while read NAME TYPE SIGNATURE VALUE FLAGS; do while read NAME TYPE SIGNATURE VALUE FLAGS; do
[[ -z "$member" || ${TYPE} == "$member" ]] && [[ -z "$member" || ${TYPE} == "$member" ]] &&
[[ -z "$required" || ${${(s: :)FLAGS}[-1]} == "$required" ]] && [[ -z "$required" || "${${(os: :)FLAGS}}" == $~required ]] &&
echo ${NAME#.} echo ${NAME#.}
done done
} }
@ -244,7 +244,7 @@ __dbus_matchspec() {
;; ;;
5) 5)
_wanted property expl 'property' \ _wanted property expl 'property' \
compadd "$@" - $(_busctl_get_members $words[2,4] "property" "writable") compadd "$@" - $(_busctl_get_members $words[2,4] "property" "*writable*")
;; ;;
6) 6)
compadd "$@" - $(_busctl_get_signature $words[2,5]) compadd "$@" - $(_busctl_get_signature $words[2,5])