From a4644e03b1aa7daf0f2d4c0474d04c3b3aabebbd Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sun, 8 Oct 2023 01:59:18 +0200 Subject: first commit --- lua/promql/health.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lua/promql/health.lua (limited to 'lua/promql') diff --git a/lua/promql/health.lua b/lua/promql/health.lua new file mode 100644 index 0000000..03f20b5 --- /dev/null +++ b/lua/promql/health.lua @@ -0,0 +1,28 @@ +local health = vim.health + +local M = {} + +local binaries = { + { bin = "promtool", optional = false }, +} + +local binary_installed = function(binary) + return vim.fn.executable(binary) +end + +M.check = function() + for _, binary in ipairs(binaries) do + if not binary_installed(binary.bin) then + local bin_not_installed = binary.bin .. " not found" + if binary.optional then + health.warn(("%s %s"):format(bin_not_installed, binary.info)) + else + health.error(binary.bin .. " not found") + end + else + health.ok(binary.bin .. " found") + end + end +end + +return M -- cgit v1.2.3