tui

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

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 9 Imported by: 0

README

tui

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoListItem

type InfoListItem interface {
	FilterValue() string
	GetName() string
	Info() string
}

InfoListItem is the interface for an info list. If an object satisfies this interface, a list prompt can be generated from a slice of these values. Additionally, the value returns from Info will render as markdown.

type InfoListModel

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

InfoListModel contains the state of the info list prompt.

func NewInfoListModel

func NewInfoListModel(input NewInfoListModelInput) (InfoListModel, error)

NewInfoListModel creates a new InfoListModel with defaults.

func (InfoListModel) Init

func (m InfoListModel) Init() tea.Cmd

Init is the first command that is called when the program starts.

func (InfoListModel) Run

func (m InfoListModel) Run() (InfoListItem, error)

Run starts the prompt.

func (InfoListModel) Update

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

Update is called when a message is received. Use it to inspect messages and, in response, update the model and/or send a command.

func (InfoListModel) View

func (m InfoListModel) View() string

View renders the model.

type NewInfoListModelInput

type NewInfoListModelInput struct {
	Title            string
	Items            []InfoListItem
	NameSingular     string
	NamePlural       string
	DisableFiltering bool
	DisableDetail    bool
}

NewInfoListModelInput is the input for the NewInfoListModel function.

type StringItem

type StringItem string

StringItem is a type that satisfies the InfoListItem interface. It's useful when you just want to display a list of strings.

func (StringItem) FilterValue

func (s StringItem) FilterValue() string

FilterValue returns the StringItem's value, which is used for filtering.

func (StringItem) GetName

func (s StringItem) GetName() string

GetName returns the StringItem's value, which is the value that is displayed in the list.

func (StringItem) Info

func (s StringItem) Info() string

Info returns the StringItem's value, which is displayed when the user selects the detail view for the item.

Jump to

Keyboard shortcuts

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