refacto: simplify interface of reload and explore
also make common group empty check in explorer utils
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user