From bcc27823e3609ec0dc16fd1d9b1c7ffdf7db9da3 Mon Sep 17 00:00:00 2001 From: Zackary Schreur Date: Mon, 15 Jul 2024 09:16:47 -0400 Subject: [PATCH] Add healthcheck --- lua/telescope/_extensions/jj.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/telescope/_extensions/jj.lua b/lua/telescope/_extensions/jj.lua index 61e28f8..f107401 100644 --- a/lua/telescope/_extensions/jj.lua +++ b/lua/telescope/_extensions/jj.lua @@ -9,4 +9,21 @@ return telescope.register_extension({ -- access extension config and user config end, exports = require("telescope-jj"), + health = function() + if vim.fn.executable("jj") == 1 then + vim.health.ok("jj installed") + end + + local obj = vim.system({ "jj", "--version" }, { text = true }):wait() + for major, minor, patch in string.gmatch(obj.stdout, ".*(%d+).(%d+).(%d+)") do + if not (tonumber(major) == 0 and tonumber(minor) >= 20) then + vim.health.warn("requires jj version 0.20.0 or greater") + vim.health.info("found jj version: " .. major .. "." .. minor .. "." .. patch) + else + vim.health.ok( + "jj version " .. major .. "." .. minor .. "." .. patch .. " is supported" + ) + end + end + end, })