selector

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultWidth  = 20
	DefaultHeight = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item string

func (Item) FilterValue

func (that Item) FilterValue() string

type ItemDelegate

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

func (ItemDelegate) Add added in v0.4.3

func (d ItemDelegate) Add(key Item)

func (ItemDelegate) Clear added in v0.4.3

func (d ItemDelegate) Clear()

func (ItemDelegate) Delete added in v0.4.3

func (d ItemDelegate) Delete(key Item)

func (ItemDelegate) GetAll added in v0.4.3

func (d ItemDelegate) GetAll() map[Item]struct{}

func (ItemDelegate) Height

func (d ItemDelegate) Height() int

func (ItemDelegate) Render

func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item)

func (ItemDelegate) Spacing

func (d ItemDelegate) Spacing() int

func (ItemDelegate) Update

func (d ItemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd

type ItemList

type ItemList struct {
	List *gtree.RedBlackTree
}

func NewItemList

func NewItemList() (li *ItemList)

func (*ItemList) Add

func (that *ItemList) Add(key string, value interface{})

func (*ItemList) Clear

func (that *ItemList) Clear()

func (*ItemList) Get

func (that *ItemList) Get(key string) interface{}

func (*ItemList) Keys

func (that *ItemList) Keys() (r []Item)

func (*ItemList) Remove

func (that *ItemList) Remove(key string) interface{}

type SOption

type SOption func(sm *SelectorModel)

func WidthEnableMulti added in v0.4.3

func WidthEnableMulti(enable bool) SOption

func WithEnbleInfinite

func WithEnbleInfinite(enable bool) SOption

func WithFilteringEnabled

func WithFilteringEnabled(show bool) SOption

func WithHeight

func WithHeight(height int) SOption

func WithShowStatusBar

func WithShowStatusBar(show bool) SOption

func WithTitle

func WithTitle(title string) SOption

func WithWidth

func WithWidth(width int) SOption

type Selector

type Selector struct {
	Program *tea.Program
	// contains filtered or unexported fields
}

func NewSelector

func NewSelector(itemList *ItemList, opts ...SOption) (sl *Selector)

func (*Selector) Run

func (that *Selector) Run()

func (*Selector) Value

func (that *Selector) Value() (r []interface{})

type SelectorModel

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

func NewSelectorModel

func NewSelectorModel(items []Item, opts ...SOption) (sm *SelectorModel)

func (*SelectorModel) ChosenList

func (that *SelectorModel) ChosenList() (r []string)

func (*SelectorModel) Init

func (that *SelectorModel) Init() tea.Cmd

func (*SelectorModel) Update

func (that *SelectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*SelectorModel) View

func (that *SelectorModel) View() string

Jump to

Keyboard shortcuts

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