simplelist

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	// contains filtered or unexported fields
}

Item is an item in the list

func NewItem

func NewItem(title, desc string) Item

NewItem creates a new item

func (Item) Description

func (i Item) Description() string

Description returns the description of the item

func (Item) FilterValue

func (i Item) FilterValue() string

FilterValue returns the title of the item

func (Item) Title

func (i Item) Title() string

Title returns the title of the item

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model contains state of the list

func New

func New(colors colorscheme.Colorscheme, title string, height int, showDesc bool) Model

New creates a new list

func (Model) GetItem

func (m Model) GetItem(text string) (list.Item, bool)

GetItem checks if the list has an item and returns it

func (Model) Index added in v1.1.0

func (m Model) Index() int

Index returns the index of the selected item

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the tab

func (*Model) IsEmpty

func (m *Model) IsEmpty() bool

IsEmpty checks if the list is empty

func (Model) Items added in v1.0.4

func (m Model) Items() []list.Item

Items returns the items in the list

func (Model) SelectedItem

func (m Model) SelectedItem() list.Item

SelectedItem returns the selected item

func (*Model) SetHeight added in v1.0.4

func (m *Model) SetHeight(height int)

SetHeight sets the height of the list

func (*Model) SetIndex added in v1.1.0

func (m *Model) SetIndex(index int)

SetIndex sets the index of the selected item

func (*Model) SetItems

func (m *Model) SetItems(items []list.Item)

SetItems sets the items in the list

func (Model) Update

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

Update updates the model

func (Model) View

func (m Model) View() string

View returns the view of the list

Jump to

Keyboard shortcuts

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