Closed Agent-E11 closed 2 months ago
Each module's condition function can be the same as it was in the original select_job
function:
-- lua/battery/parsers/powershell.lua
local M = {}
function M.cond()
return vim.fn.has('win32') and vim.fn.executable('powershell') == 1
end
-- lua/battery/parsers/powersupply.lua
local file = require('util.file')
local M = {}
function M.cond()
return file.is_readable_directory('/sys/class/power_supply/')
end
yeah it seems nice.
minor thing i don't like the name cond, maybe pred or check
Ok, that is fine. I am not attached to the name
I like check, but pred would work too
The top-level
battery
module is getting a little cluttered with all the parsers. I think it would make sense to create a submodule for all the parsers:Then, we could loop over the parsers: