Redesign component interfaces
[khatus.git] / bin / khatus_parse_upower
index 6761508..af73e19 100755 (executable)
@@ -1,5 +1,10 @@
 #! /usr/bin/awk -f
 
+BEGIN {
+    OFS = msg_fs ? msg_fs : "|"
+    Kfs = key_fs ? key_fs : ":"
+}
+
 # When parsing 'upower --dump'
 /^Device:[ \t]+/ {
     device["path"] = $2
 
 /    percentage:/ && device["is_battery"] {
     device["battery_percentage"] = $2
+    sub("%$", "", device["battery_percentage"])
     next
 }
 
 /^$/ && device["is_battery"] {
-    printf("battery %s %s\n", device["battery_state"], device["battery_percentage"])
+    print("battery_state"     , device["battery_state"])
+    print("battery_percentage", device["battery_percentage"])
 }
 # END battery
 
@@ -45,7 +52,7 @@
 }
 
 /^$/ && device["is_line_power"] {
-    printf("line_power %s\n", device["line_power_online"])
+    print("line_power", device["line_power_online"])
 }
 # END line-power
 
This page took 0.021341 seconds and 4 git commands to generate.