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.
__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
}
;;
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])