selector

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 9 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

func (d ItemDelegate) Add(key Item)

func (ItemDelegate) Clear

func (d ItemDelegate) Clear()

func (ItemDelegate) Delete

func (d ItemDelegate) Delete(key Item)

func (ItemDelegate) GetAll

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

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

func (that *Selector) SetProgramOpts(opts ...tea.ProgramOption)

func (*Selector) Value

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

func (*Selector) Values

func (that *Selector) Values() (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) SetSubmitCmd

func (that *SelectorModel) SetSubmitCmd(scmd tea.Cmd)

func (*SelectorModel) Update

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

func (*SelectorModel) Values

func (that *SelectorModel) Values() (r map[string]string)

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