summaryrefslogtreecommitdiff
path: root/lua/promql
diff options
context:
space:
mode:
Diffstat (limited to 'lua/promql')
-rw-r--r--lua/promql/health.lua28
1 files changed, 28 insertions, 0 deletions
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