feat: add the possibility to delete files. and restrict the editing of files to inside the project
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user