mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 21:06:46 +00:00
feat: added opts.headless
to control ansi output when running headless
This commit is contained in:
parent
93b3a77286
commit
a0a51c06c2
5 changed files with 153 additions and 10 deletions
|
@ -48,6 +48,7 @@ local uv = vim.uv
|
|||
---@field cwd? string
|
||||
---@field on_line? fun(string)
|
||||
---@field on_exit? fun(ok:boolean, output:string)
|
||||
---@field on_data? fun(string)
|
||||
---@field timeout? number
|
||||
---@field env? table<string,string>
|
||||
|
||||
|
@ -145,6 +146,11 @@ function M.spawn(cmd, opts)
|
|||
assert(not err, err)
|
||||
|
||||
if data then
|
||||
if opts.on_data then
|
||||
vim.schedule(function()
|
||||
opts.on_data(data)
|
||||
end)
|
||||
end
|
||||
output = output .. data:gsub("\r\n", "\n")
|
||||
local lines = vim.split(vim.trim(output:gsub("\r$", "")):gsub("[^\n\r]+\r", ""), "\n")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue