refactor: rewrite installation using jobs and async

Replace sync variants with callback support
This commit is contained in:
Lewis Russell 2023-05-22 14:35:25 +01:00 committed by Christian Clason
parent 5aa2984a02
commit cde679e435
15 changed files with 951 additions and 709 deletions

View file

@ -0,0 +1,28 @@
local uv = vim.loop
local M = {}
--- @param filename string
--- @return string
function M.read_file(filename)
local file = assert(io.open(filename, 'r'))
local r = file:read('*a')
file:close()
return r
end
--- @param filename string
--- @param content string
function M.write_file(filename, content)
local file = assert(io.open(filename, 'w'))
file:write(content)
file:close()
end
--- Recursively delete a directory
--- @param name string
function M.delete(name)
vim.fs.rm(name, { recursive = true, force = true })
end
return M