aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-parsers.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua
index 36be0b9c4..cb7389e19 100755
--- a/scripts/install-parsers.lua
+++ b/scripts/install-parsers.lua
@@ -1,11 +1,14 @@
#!/usr/bin/env -S nvim -l
local generate = false
+local update = false
local max_jobs = nil ---@as integer
local parsers = {}
for i = 1, #_G.arg do
if _G.arg[i] == '--generate' then
generate = true
+ elseif _G.arg[i] == '--update' then
+ update = true
elseif _G.arg[i]:find('^%-%-max%-jobs') then
max_jobs = _G.arg[i]:match('=(%d+)')
else
@@ -19,13 +22,19 @@ vim.opt.runtimepath:append('.')
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
local ok = nil
-require('nvim-treesitter.install').install(
- #parsers > 0 and parsers or 'all',
- { force = true, generate = generate, max_jobs = max_jobs },
- function(success)
+if update then
+ require('nvim-treesitter.install').update('all', {}, function(success)
ok = success
- end
-)
+ end)
+else
+ require('nvim-treesitter.install').install(
+ #parsers > 0 and parsers or 'all',
+ { force = true, generate = generate, max_jobs = max_jobs },
+ function(success)
+ ok = success
+ end
+ )
+end
vim.wait(6000000, function()
return ok ~= nil