repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
neovim/lua/bugabinga/health.lua
Raw-- use the neovim healthcheck module to integrate into :checkhealth.
-- check the system for dependencies, that:
-- * i like to use with neovim.
-- * plugins need.
local executable = require 'std.executable'
local programs_to_check = {}
local function check_program(name, name_of_executable)
local display_name = name and (name .. '(' .. name_of_executable .. ')') or name_of_executable
vim.health.start(display_name .. ' report')
if executable(name_of_executable) then
vim.health.ok(display_name .. ' found on system')
else
vim.health.error(display_name .. ' is not installed on the system')
end
end
local function add_dependency(program)
vim.validate('program', program, 'table')
vim.validate('name_of_executable', program.name_of_executable, 'string')
programs_to_check[program.name_of_executable] = program
return add_dependency
end
local function check()
vim.iter(programs_to_check)
:each(function(_, program)
check_program(program.name, program.name_of_executable)
end)
end
return {
add_dependency = add_dependency,
check = check,
}