tree

package
v0.0.0-...-ec6486c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 5 Imported by: 0

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
}

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
	// contains filtered or unexported fields
}

func New

func New(nodes []Node) Model

func (Model) Cursor

func (m Model) Cursor() int

func (Model) FullHelp

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

func (Model) GetNodeAtCurrentCursor

func (m Model) GetNodeAtCurrentCursor() (Node, bool)

GetNodeAtBFSIndex returns the node at a specific index in a breadth-first search traversal.

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) SetNodes

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

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

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
}

Jump to

Keyboard shortcuts

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