add comments to fs
This commit is contained in:
@ -3,12 +3,18 @@ local logger = require('dep.log')
|
|||||||
|
|
||||||
local fs = {}
|
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)
|
function fs:sync(package, cb)
|
||||||
if not package.exists then
|
if not package.exists then
|
||||||
fs:link(package, cb)
|
fs:link(package, cb)
|
||||||
end
|
end
|
||||||
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)
|
function fs:link(package, cb)
|
||||||
h.uv.fs_symlink(package.path, package.dir, nil, function(err, _)
|
h.uv.fs_symlink(package.path, package.dir, nil, function(err, _)
|
||||||
if err then
|
if err then
|
||||||
@ -44,6 +50,7 @@ function fs:clean(package)
|
|||||||
queue[pkg.name] = nil
|
queue[pkg.name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- start deleting all of the packages which are chosen for deletion
|
||||||
for name, dir in pairs(queue) do
|
for name, dir in pairs(queue) do
|
||||||
local co = coroutine.create(function()
|
local co = coroutine.create(function()
|
||||||
local ok = vim.fn.delete(dir, "rf")
|
local ok = vim.fn.delete(dir, "rf")
|
||||||
|
Reference in New Issue
Block a user