busctl: add wait verb to wait for signals

It's like busctl call, but it waits for a signal rather than a reply to
a method call.
This commit is contained in:
Ronan Pigott
2024-10-12 19:30:56 -07:00
parent 2b577d598b
commit 30465af656
3 changed files with 137 additions and 0 deletions
+26
View File
@@ -29,6 +29,7 @@
"tree:Show object tree of service"
"introspect:Introspect object"
"call:Call a method"
"wait:Wait for a signal"
"get-property:Get property value"
"set-property:Set property value"
)
@@ -201,6 +202,31 @@ __dbus_matchspec() {
esac
}
(( $+functions[_busctl_wait] )) || _busctl_wait()
{
local expl
case $CURRENT in
2)
_wanted busname expl 'busname' \
compadd "$@" - $(_busctl_get_service_names)
;;
3)
_wanted path expl 'path' \
compadd "$@" - $(_busctl_get_objects $words[2])
;;
4)
_wanted interface expl 'interface' \
compadd "$@" - $(_busctl_get_interfaces $words[2,3])
;;
5)
_wanted method expl 'method' \
compadd "$@" - $(_busctl_get_members $words[2,4] "signal")
;;
*)
_message "no more options"
esac
}
(( $+functions[_busctl_get-property] )) || _busctl_get-property()
{
local expl