Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 1.4 KB

README.md

File metadata and controls

67 lines (53 loc) · 1.4 KB

Tree Model for BubbleTea TUI framework

This is a package to be used in applications based on Bubble Tea TUI framework.

It can be used to output an interactive tree model.

The nodes of the tree, need to conform to a simple interface.

type Node interface {
	tea.Model
	Parent() Node
	Children() Nodes
	State() NodeState
}

Instalation

go get github.com/mariusor/bubbles-tree

Examples

To see two of the possible usages for this package check the examples folder where we have a minimal filesystem tree utility and a threaded conversation.

$ go run main.go -depth 3 ../../
 └─ ⊟ /some/path/bubbles-tree
    ├─ ⊟ examples
    │  └─ ⊟ tree
    │     ├─   go.mod
    │     ├─   go.sum
    │     ├─   go.work
    │     └─   main.go
    ├─   go.mod
    ├─   go.sum
    ├─   tree.go
    └─   tree_test.go

Conversation

 $ go run . -depth 3
╻
┃ Root node
┃ Sphinx of black quartz, judge my vow!
┃ The quick brown fox jumps over the lazy dog.
╹
┃ ╻
┃ ┃ Child node
┃ ┃ Sphinx of black quartz, judge my vow!
┃ ┃ The quick brown fox jumps over the lazy dog.
┃ ╹
┃ ┃ ╻
┃ ┃ ┃ Child node
┃ ┃ ┃ Sphinx of black quartz, judge my vow!
┃ ┃ ┃ The quick brown fox jumps over the lazy dog.
┃ ┃ ╹