Skip to content

Commit

Permalink
Remove extra branch that broke when "rate information unavailable"
Browse files Browse the repository at this point in the history
  • Loading branch information
umar456 committed Jan 13, 2020
1 parent 428b32d commit 95cc9b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions batteryarc-widget/batteryarc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ local function worker(args)
local battery_info = {}
local capacities = {}
for s in stdout:gmatch("[^\r\n]+") do
local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?.*')
if string.match(s, 'rate information') then
-- ignore such line
elseif status ~= nil then
local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?(.*)')
if status ~= nil then
table.insert(battery_info, { status = status, charge = tonumber(charge_str) })
else
local cap_str = string.match(s, '.+:.+last full capacity (%d+)')
Expand Down

0 comments on commit 95cc9b9

Please sign in to comment.