MCPcopy Create free account
hub / github.com/Macmod/godap / expandTreeNode

Function expandTreeNode

tui/explorer.go:74–97  ·  view source on GitHub ↗
(node *tview.TreeNode)

Source from the content-addressed store, hash-verified

72}
73
74func expandTreeNode(node *tview.TreeNode) {
75 if !node.IsExpanded() {
76 if len(node.GetChildren()) == 0 {
77 go app.QueueUpdateDraw(func() {
78 updateLog("Loading children ("+node.GetReference().(string)+")", "yellow")
79 ok := loadChildren(node)
80 if !ok {
81 return
82 }
83
84 n := len(node.GetChildren())
85
86 if n != 0 {
87 node.SetExpanded(true)
88 updateLog("Loaded "+strconv.Itoa(n)+" children ("+node.GetReference().(string)+")", "green")
89 } else {
90 updateLog("Node "+node.GetReference().(string)+" has no children", "green")
91 }
92 })
93 } else {
94 node.SetExpanded(true)
95 }
96 }
97}
98
99func collapseTreeNode(node *tview.TreeNode) {
100 node.SetExpanded(false)

Callers 1

treePanelKeyHandlerFunction · 0.85

Calls 2

updateLogFunction · 0.85
loadChildrenFunction · 0.85

Tested by

no test coverage detected