4 OFS = msg_fs ? msg_fs
: "|"
5 Kfs = key_fs ? key_fs
: ":"
8 # When parsing 'upower --dump'
14 # When parsing 'upower --monitor-detail'
15 /^\
[[0-9]+:[0-9]+:[0-9]+\.
[0-9]+\
][ \t]+device changed
:[ \t]+/ {
21 / battery
/ && device
["path"] {
22 device
["is_battery"] =
1
26 / state
:/ && device
["is_battery"] {
27 device
["battery_state"] = $
2
31 / percentage
:/ && device
["is_battery"] {
32 device
["battery_percentage"] = $
2
33 sub("%$", "", device
["battery_percentage"])
37 /^$
/ && device
["is_battery"] {
38 print("battery_state" , device
["battery_state"])
39 print("battery_percentage", device
["battery_percentage"])
44 / line
-power
/ && device
["path"] {
45 device
["is_line_power"] =
1
49 / online
:/ && device
["is_line_power"] {
50 device
["line_power_online"] = $
2
54 /^$
/ && device
["is_line_power"] {
55 print("line_power", device
["line_power_online"])
This page took 0.090816 seconds and 4 git commands to generate.