2020-12-30 14:48:51 +00:00
|
|
|
local M = { }
|
|
|
|
|
2021-01-04 01:14:29 +00:00
|
|
|
function M.draw_section(section, separator)
|
2021-01-03 19:11:22 +00:00
|
|
|
local status = {}
|
2021-01-04 01:14:29 +00:00
|
|
|
for _, status_function in pairs(section) do
|
|
|
|
local localstatus = status_function()
|
2021-01-03 19:11:22 +00:00
|
|
|
if #localstatus > 0 then
|
|
|
|
table.insert(status, localstatus)
|
2020-12-30 14:48:51 +00:00
|
|
|
end
|
|
|
|
end
|
2021-01-03 19:11:22 +00:00
|
|
|
if #status == 0 then
|
|
|
|
return ''
|
|
|
|
end
|
|
|
|
local sep = ' '
|
|
|
|
if #separator > 0 then
|
|
|
|
sep = ' ' .. separator .. ' '
|
2020-12-30 14:48:51 +00:00
|
|
|
end
|
2021-01-03 19:11:22 +00:00
|
|
|
return ' ' .. table.concat(status, sep) .. ' '
|
2020-12-30 14:48:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|