From 47796d597ead8fe8d7031a4ed3516d6b9cb22667 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 6 May 2025 17:13:12 -0500 Subject: [PATCH] add comments to fs --- lua/dep/fs.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/dep/fs.lua b/lua/dep/fs.lua index c19f858..0c32a6c 100644 --- a/lua/dep/fs.lua +++ b/lua/dep/fs.lua @@ -3,12 +3,18 @@ local logger = require('dep.log') local fs = {} +--- abstract away fs:link to make calling more intuitive +---@param package package package to update +---@param cb function callback on success function fs:sync(package, cb) if not package.exists then fs:link(package, cb) end end +--- create a symlink to a local package +---@param package package package to link +---@param cb function callback on success function fs:link(package, cb) h.uv.fs_symlink(package.path, package.dir, nil, function(err, _) if err then @@ -44,6 +50,7 @@ function fs:clean(package) queue[pkg.name] = nil end + -- start deleting all of the packages which are chosen for deletion for name, dir in pairs(queue) do local co = coroutine.create(function() local ok = vim.fn.delete(dir, "rf")