feat: add the possibility to delete files. and restrict the editing of files to inside the project

This commit is contained in:
2024-12-13 02:30:54 +01:00
parent 2eb79c2b1a
commit cc37c8505c
3 changed files with 38 additions and 3 deletions

View File

@@ -32,6 +32,18 @@ function M.write_file(filepath, content)
uv.fs_close(fd)
end
function M.delete_file(filepath)
local st = uv.fs_stat(filepath)
if st then
local success, err = uv.fs_unlink(filepath)
if not success then
vim.api.nvim_err_writeln("Could not delete file: " .. filepath .. " - " .. (err or "unknown error"))
end
else
vim.api.nvim_err_writeln("File not found, cannot delete: " .. filepath)
end
end
function M.finish()
print("Finished processing files.")
end