tree

package module
v0.0.0-...-d7bb06a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 6 Imported by: 0

README

Tree Bubble 🌳🫧

Go Reference All Contributors

A TUI tree view for Charm's Bubble Tea framework

Installation

go get github.com/savannahostrowski/tree-bubble

Example

For an example please take a look at the /example directory.

Contributing

Contributions are welcome! To get started, check out the contributing guidelines.

Contributors

A big thank you to these wonderful humans for their contributions!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	Bottom      key.Binding
	Top         key.Binding
	SectionDown key.Binding
	SectionUp   key.Binding
	Down        key.Binding
	Up          key.Binding
	Quit        key.Binding

	ShowFullHelp  key.Binding
	CloseFullHelp key.Binding
}

KeyMap holds the key bindings for the table.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap is the default key bindings for the table.

type Model

type Model struct {
	KeyMap KeyMap
	Styles Styles

	Help help.Model

	AdditionalShortHelpKeys func() []key.Binding
	// contains filtered or unexported fields
}

func New

func New(nodes []Node, width int, height int) Model

func (Model) Cursor

func (m Model) Cursor() int

func (Model) FullHelp

func (m Model) FullHelp() [][]key.Binding

func (Model) Height

func (m Model) Height() int

func (*Model) NavDown

func (m *Model) NavDown()

func (*Model) NavUp

func (m *Model) NavUp()

func (Model) Nodes

func (m Model) Nodes() []Node

func (*Model) NumberOfNodes

func (m *Model) NumberOfNodes() int

func (*Model) SetCursor

func (m *Model) SetCursor(cursor int)

func (*Model) SetHeight

func (m *Model) SetHeight(newHeight int)

func (*Model) SetNodes

func (m *Model) SetNodes(nodes []Node)

func (*Model) SetShowHelp

func (m *Model) SetShowHelp() bool

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

func (*Model) SetWidth

func (m *Model) SetWidth(newWidth int)

func (Model) ShortHelp

func (m Model) ShortHelp() []key.Binding

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

func (Model) Width

func (m Model) Width() int

type Node

type Node struct {
	Value    string
	Desc     string
	Children []Node
}

type Styles

type Styles struct {
	Shapes     lipgloss.Style
	Selected   lipgloss.Style
	Unselected lipgloss.Style
	Help       lipgloss.Style
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL