2023-05-29 16:52:20 +02:00
|
|
|
#!/usr/bin/env -S nvim -l
|
|
|
|
|
|
2024-04-18 09:44:38 +02:00
|
|
|
local generate = false
|
2024-08-27 11:02:34 +02:00
|
|
|
local max_jobs = nil ---@as integer
|
2024-04-18 09:44:38 +02:00
|
|
|
local parsers = {}
|
|
|
|
|
for i = 1, #_G.arg do
|
|
|
|
|
if _G.arg[i] == '--generate' then
|
|
|
|
|
generate = true
|
2024-08-27 11:02:34 +02:00
|
|
|
elseif _G.arg[i]:find('^%-%-max%-jobs') then
|
|
|
|
|
max_jobs = _G.arg[i]:match('=(%d+)')
|
2024-04-18 09:44:38 +02:00
|
|
|
else
|
|
|
|
|
parsers[#parsers + 1] = _G.arg[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-05-29 16:52:20 +02:00
|
|
|
vim.opt.runtimepath:append('.')
|
|
|
|
|
|
|
|
|
|
-- needed on CI
|
|
|
|
|
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
|
|
|
|
|
|
2024-10-12 20:14:21 +02:00
|
|
|
local ok = nil
|
2024-04-18 09:44:38 +02:00
|
|
|
require('nvim-treesitter.install').install(
|
|
|
|
|
#parsers > 0 and parsers or 'all',
|
2024-08-27 11:02:34 +02:00
|
|
|
{ force = true, generate = generate, max_jobs = max_jobs },
|
2024-10-12 20:14:21 +02:00
|
|
|
function(success)
|
|
|
|
|
ok = success
|
2024-04-18 09:44:38 +02:00
|
|
|
end
|
|
|
|
|
)
|
2023-05-29 16:52:20 +02:00
|
|
|
|
|
|
|
|
vim.wait(6000000, function()
|
2024-10-12 20:14:21 +02:00
|
|
|
return ok ~= nil
|
2023-05-29 16:52:20 +02:00
|
|
|
end)
|
2024-10-12 20:14:21 +02:00
|
|
|
if not ok then
|
|
|
|
|
vim.cmd.cq()
|
|
|
|
|
end
|