mirror of
https://github.com/vicious-widgets/vicious
synced 2023-12-14 07:13:07 +01:00
Convert tabs to spaces and better adhere to the code style practices
This commit is contained in:
parent
ce66335081
commit
25897d5982
14
helpers.lua
14
helpers.lua
|
@ -256,21 +256,21 @@ function helpers.sysctl_async(path_table, parse)
|
|||
end,
|
||||
stderr = function(line)
|
||||
local messages = {
|
||||
openbsd = {"level name .+ in (.+) is invalid"},
|
||||
linux = {"cannot stat /proc/sys/(.+):",
|
||||
"permission denied on key '(.+)'"},
|
||||
freebsd = {"unknown oid '(.+)'"}
|
||||
openbsd = { "level name .+ in (.+) is invalid" },
|
||||
linux = { "cannot stat /proc/sys/(.+):",
|
||||
"permission denied on key '(.+)'" },
|
||||
freebsd = { "unknown oid '(.+)'" }
|
||||
}
|
||||
|
||||
for i=1,#messages[helpers.getos()] do
|
||||
local key = line:match(messages[helpers.getos()][i])
|
||||
for _, error_message in ipairs(messages[helpers.getos()]) do
|
||||
local key = line:match(error_message)
|
||||
if key then
|
||||
key = key:gsub("/", ".")
|
||||
ret[key] = "N/A"
|
||||
end
|
||||
end
|
||||
end,
|
||||
output_done = function() parse(ret) end
|
||||
output_done = function () parse(ret) end
|
||||
})
|
||||
end
|
||||
-- }}}
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local table = {
|
||||
insert = table.insert
|
||||
}
|
||||
|
||||
local math = {
|
||||
floor = math.floor,
|
||||
modf = math.modf
|
||||
|
@ -43,7 +47,7 @@ function bat_openbsd.async(format, warg, callback)
|
|||
for _, v in pairs(fields) do table.insert(sysctl_args, v) end
|
||||
|
||||
local battery = {}
|
||||
helpers.sysctl_async(sysctl_args, function(ret)
|
||||
helpers.sysctl_async(sysctl_args, function (ret)
|
||||
for k, v in pairs(fields) do
|
||||
-- discard the description that comes after the values
|
||||
battery[k] = tonumber(ret[v]:match("(.-) "))
|
||||
|
|
Loading…
Reference in a new issue