From ac2585d61896b27b6f53f35c033929665564724b 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..02dd5e4 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) >= 19) then + vim.health.warn("requires jj version 0.19.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, })