curl.nvim/lua/curl/health.lua (view raw)
| 1 | local function check(bin, msg, optional) |
| 2 | if vim.fn.executable(bin) == 1 then |
| 3 | vim.health.ok(bin .. " found on PATH: `" .. vim.fn.exepath(bin) .. "`") |
| 4 | return |
| 5 | end |
| 6 | |
| 7 | if optional then |
| 8 | vim.health.warn(bin .. " not found on PATH, " .. msg) |
| 9 | else |
| 10 | vim.health.error(bin .. " not found on PATH, " .. msg) |
| 11 | end |
| 12 | end |
| 13 | |
| 14 | return { |
| 15 | check = function() |
| 16 | vim.health.start "Neovim version" |
| 17 | if vim.fn.has "nvim-0.12" == 1 then |
| 18 | vim.health.ok "Neovim version is compatible" |
| 19 | else |
| 20 | vim.health.error "nvim-0.12 or newer is required" |
| 21 | end |
| 22 | |
| 23 | vim.health.start "Required dependencies" |
| 24 | check("curl", "required to run requests", false) |
| 25 | |
| 26 | vim.health.start "Optional dependencies" |
| 27 | check("jq", "used for JSON formatting in output buffers", true) |
| 28 | end, |
| 29 | } |