Skip to content

Commit

Permalink
Rename to use node
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed May 2, 2020
1 parent 1753afb commit 351b156
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/gui/item/source_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ func (s *SourceFiles) SetKeybinds(globalKeybind func(event *tcell.EventKey), sel
}

// AddChildren adds child nodes to the given node which represents a directory.
func (s *SourceFiles) addChildren(target *tview.TreeNode, path string) error {
func (s *SourceFiles) addChildren(node *tview.TreeNode, path string) error {
files, err := ioutil.ReadDir(path)
if err != nil {
return err
}
for _, file := range files {
node := tview.NewTreeNode(file.Name()).
child := tview.NewTreeNode(file.Name()).
SetReference(filepath.Join(path, file.Name())).
SetSelectable(file.IsDir())
if file.IsDir() {
node.SetColor(tcell.ColorGreen)
child.SetColor(tcell.ColorGreen)
}
target.AddChild(node)
node.AddChild(child)
}
return nil
}
Expand Down

0 comments on commit 351b156

Please sign in to comment.