Skip to content

Commit

Permalink
Add healthcheck
Browse files Browse the repository at this point in the history
- Checks that jj is installed
- Checks that jj version is supported
  • Loading branch information
zschreur committed Jul 15, 2024
1 parent 6ec75eb commit 8fcd988
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lua/telescope/_extensions/jj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

0 comments on commit 8fcd988

Please sign in to comment.