simplelist

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: GPL-3.0 Imports: 9 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 a single item in a list

func NewItem

func NewItem(title string, description string, moreContent string) Item

NewItem creates a new list item

func (Item) Description

func (m Item) Description() string

Description returns the description of the item

func (Item) FilterValue

func (m Item) FilterValue() string

FilterValue returns the value which is used for filtering

func (Item) StyleContent

func (m Item) StyleContent(width int) (string, error)

StyleContent styles the content of the item with glamour and returns the result

func (Item) Title

func (m Item) Title() string

Title returns the title of the item

func (Item) WrapDescription

func (m Item) WrapDescription(width int) Item

WrapDescription wraps the description to the given width

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 by a [0-9] index and also a [a-z] index if the list has more than 10 elements

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

func (m Model) SelectedItem() list.Item

SelectedItem returns 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 the variables in the list

func (Model) View

func (m Model) View() string

View the list

Jump to

Keyboard shortcuts

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