feat(picker): better checkhealth
Some checks failed
CI / ci (push) Failing after 0s

This commit is contained in:
Folke Lemaitre 2025-02-03 21:06:08 +01:00
parent 91a4e5fdb8
commit b773368f8a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 24 additions and 11 deletions

View file

@ -16,21 +16,32 @@ function M.health()
Snacks.health.has_lang("regex")
Snacks.health.have_tool("git")
local have_rg = Snacks.health.have_tool("rg")
local have_fd = Snacks.health.have_tool({
if not have_rg then
Snacks.health.error("'rg' is required for `Snacks.picker.grep()`")
else
Snacks.health.ok("`Snacks.picker.grep()` is available")
end
local have_fd, version_fd = Snacks.health.have_tool({
{ cmd = { "fd", "fdfind" }, version = "v8.4" },
})
local have_find = Snacks.health.have_tool({
{ cmd = "find", enabled = jit.os:find("Windows") == nil },
})
if have_rg or have_fd or have_find then
Snacks.health.ok("`Snacks.picker.files()` is available")
else
Snacks.health.error("'rg', 'fd' or 'find' is required for `Snacks.picker.files()`")
end
if not have_rg then
Snacks.health.warn("'rg' is required for `Snacks.picker.grep()`")
end
if not have_rg and not have_fd then
Snacks.health.warn("'rg' or 'fd' is required for `Snacks.picker.files()`")
end
if not have_fd then
Snacks.health.warn("'fd' is required for `Snacks.picker.explorer()`")
if not have_fd or not version_fd then
Snacks.health.error("'fd' `v8.4` is required for `Snacks.picker.explorer()`")
else
Snacks.health.ok("`Snacks.picker.explorer()` is available")
end
local ok = pcall(require, "snacks.picker.util.db")
if ok then
Snacks.health.ok("`SQLite3` is available")