| 1 |
#compdef -value-,DBUS_SESSION_BUS_ADDRESS,-default- -value-,DBUS_SYSTEM_BUS_ADDRESS,-default- |
| 2 |
|
| 3 |
local context state state_descr line |
| 4 |
typeset -A val_args |
| 5 |
|
| 6 |
_values -S: kind \ |
| 7 |
'unix[a unix domain socket]:unix properties:->unix' \ |
| 8 |
'tcp[a tcp socket]:tcp properties:->tcp' \ |
| 9 |
'unixexec[a process]:unixexec properties:->unixexec' \ |
| 10 |
'x-machine-unix[a container]:machine properties:->x-machine-unix' |
| 11 |
|
| 12 |
_sd_bus_get_guid() { |
| 13 |
local TYPE VALUE |
| 14 |
local -a busname=(org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus) |
| 15 |
|
| 16 |
_call_program -l dbus-guid busctl call $busname GetId | |
| 17 |
while read TYPE VALUE; do |
| 18 |
[[ $TYPE == 's' && -n $VALUE ]] && compadd "$@" - ${(Q)VALUE}; |
| 19 |
done |
| 20 |
} |
| 21 |
|
| 22 |
local expl ret |
| 23 |
case $context in |
| 24 |
unix) |
| 25 |
_values -s, 'unix socket properties' \ |
| 26 |
'guid[bus guid]:bus guid:_sd_bus_get_guid -qS,' \ |
| 27 |
'(abstract)path[unix domain socket path]:path:_files -r, -g "*(=)"' \ |
| 28 |
'(path)abstract[unix domain socket path in the abstract namespace]:abstract path:_files -r, -P@ -g "*(=)"' \ |
| 29 |
'uid[unix uid]:uid:_numbers' \ |
| 30 |
'gid[unix gid]:gid:_numbers' |
| 31 |
;; |
| 32 |
tcp) |
| 33 |
_values -s, 'unix socket properties' \ |
| 34 |
'guid[bus guid]:bus guid:_sd_bus_get_guid -qS,' \ |
| 35 |
'host[hostname]:hostname:_hosts -r,'\ |
| 36 |
'port[port]:port:_numbers' \ |
| 37 |
'family[address family]:address family:(ipv4 ipv6)' |
| 38 |
;; |
| 39 |
unixexec) |
| 40 |
_values -s, 'unixexec properties' \ |
| 41 |
'guid[bus guid]:bus guid:_sd_bus_get_guid -qS,' \ |
| 42 |
'path[command path]:command path:_absolute_command_paths -r,'\ |
| 43 |
;; |
| 44 |
x-machine-unix) |
| 45 |
_values -s, 'machine properties' \ |
| 46 |
'guid[bus guid]:bus guid:_sd_bus_get_guid -qS,' \ |
| 47 |
'(pid)machine[machine]:machine:_call_function ret _sd_machines' \ |
| 48 |
'(machine)pid[pid]:pid:_pids' |
| 49 |
;; |
| 50 |
esac |