mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 05:30:03 +01:00
This is useful when asking people to give information about battery health. It avoids having to give two-step instructions of first enumerating devices with `upower -e`, then looking for a device whose name starts with `/org/freedesktop/UPower/devices/battery_`, then running `upower -i` on that device. Signed-off-by: Josh Triplett <josh@joshtriplett.org>
22 lines
775 B
Text
22 lines
775 B
Text
#compdef upower
|
|
_enumerate_objects() {
|
|
local expl
|
|
local -a objects
|
|
objects=( ${(f)"$(
|
|
_call_program upower-enumerate-objects \
|
|
upower -e
|
|
)"} )
|
|
_wanted objects expl "object path" \
|
|
compadd -a objects -d objects
|
|
}
|
|
|
|
_arguments \
|
|
"(--battery -b)"{--battery,-b}"[Dump all parameters for battery objects]" \
|
|
"(--enumerate -e)"{--enumerate,-e}"[Enumerate objects paths for devices]" \
|
|
"(--dump -d)"{--dump,-d}"[Dump all parameters for all objects]" \
|
|
"(--monitor -m)"{--monitor,-m}"[Monitor activity from the power daemon]" \
|
|
"--monitor-detail""[Monitor with detail]" \
|
|
"(--show-info -i)"{--show-info,-i}"[Show information about object path]"":::_enumerate_objects" \
|
|
"(--version -v)"{--version,-v}"[Print version of client and daemon"] \
|
|
|
|
compdef _upower upower
|