Skip to content

Commit

Permalink
Add health check for plugin dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
erichlf committed Apr 30, 2024
1 parent a503eac commit d85416f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lua/devcontainer-cli/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ local function verify_binary(binary_name)
ok(("`%s` executable found."):format(binary_name))
end
end
-- TODO: create a check for DevcontainerUp, this needs to be done after

local function verify_plugin_dependencies(plugin_name)
if require(plugin_name) then
ok(("`%s` plugin found."):format(plugin_name))
else
error(("`%s` plugin not found."):format(plugin_name), ("Add %s to dependencies in Lazy.git"):format(plugin_name))
end
end

-- TODO: create a check for DevcontainerUp, this needs to be done after
-- creating the ability to stop a container
-- TODO: create a check for DevcontainerExec

Expand All @@ -22,9 +31,15 @@ function M.check()
"docker",
"devcontainer",
}
local plugin_dependencies = {
"toggleterm",
}
for _, bin_name in ipairs(required_binaries) do
verify_binary(bin_name)
end
for _, plugin_name in ipairs(plugin_dependencies) do
verify_plugin_dependencies(plugin_name)
end
end

return M

0 comments on commit d85416f

Please sign in to comment.