refacto: simplify interface of reload and explore

also make common group empty check in explorer utils
This commit is contained in:
kiyan
2022-02-20 15:08:36 +01:00
parent 41f51508e3
commit 527d88d54e
6 changed files with 32 additions and 25 deletions

View File

@@ -19,9 +19,10 @@ function Explorer.new(cwd)
}, Explorer)
end
function Explorer:_load(cwd, node)
function Explorer:_load(node)
local cwd = node.cwd or node.link_to or node.absolute_path
git.load_project_status(cwd, function(git_statuses)
M.explore(node, cwd, git_statuses)
M.explore(node, git_statuses)
if type(self.init_cb) == "function" then
self.init_cb(self)
self.init_cb = nil
@@ -31,12 +32,12 @@ end
function Explorer:expand(node)
self.init_cb = renderer.draw
self:_load(node.link_to or node.absolute_path, node)
self:_load(node)
end
function Explorer:init(f)
self.init_cb = f
self:_load(self.cwd, self)
self:_load(self)
end
function M.setup(opts)