local M = {} cmdsList = nil function M.checkCommand(cmd, desc) local toRun = "" if IS_UNIX then toRun = "command -v " .. cmd else toRun = "where " .. cmd end local p = io.popen(toRun) local output = p:read("*l") p:close() if output == nil and desc ~= nil and desc ~= "" then vim.api.nvim_echo({ { " ✗ " .. cmd .. " [" .. desc .. "] - not found!", "DiagnosticError" } }, true, {}) elseif output == nil then vim.api.nvim_echo({ { " ✗ " .. cmd .. " not found!", "DiagnosticError" } }, true, {}) else vim.api.nvim_echo({ { " ✓ " .. cmd, "DiagnosticOk" } }, true, {}) end end function M.run() print("Check installed system commands:") for i, cmd in ipairs(cmdsList) do M.checkCommand(cmd.cmd, cmd.desc) end end function M.setup(cmds) IS_UNIX = package.config:sub(1, 1) ~= "\\" cmdsList = cmds vim.api.nvim_create_user_command("DependenciesCheck", M.run, {}) end return M