tui

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChooseMany

func ChooseMany(title string, isLastStep bool, options []string) ([]string, error)

func ChooseOne

func ChooseOne(title string, isOptionalStep bool, isLastStep bool, options []string) (string, error)

func List

func List(items []string) error

func New

func New(items []string, delegate ItemDelegate, width, height int) listModel

func Send

func Send(cmd *cobra.Command, args []string, action func(cmd *cobra.Command, args []string) error) error

Types

type FilterFunc

type FilterFunc func(string, []string) []Rank

type FilterMatchesMsg

type FilterMatchesMsg []filteredItem

type FilterState

type FilterState int
const (
	Unfiltered FilterState = iota
	Filtering
	FilterApplied
)

func (FilterState) String

func (f FilterState) String() string

type Input

type Input struct {
	Placeholder string
	IsPassword  bool
	Value       *string
}

func TextInputs

func TextInputs(title string, isLastStep bool, values ...Input) ([]Input, error)

type Item

type Item interface {
	FilterValue() string
}

type ItemDelegate

type ItemDelegate interface {
	Render(w io.Writer, m listModel, item string)
	Height() int
	Spacing() int
	Update(msg tea.Msg, m *listModel) tea.Cmd
}

type KeyMap

type KeyMap struct {
	NextPage             key.Binding
	PrevPage             key.Binding
	Filter               key.Binding
	ClearFilter          key.Binding
	CancelWhileFiltering key.Binding
	AcceptWhileFiltering key.Binding
	Quit                 key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

type ListModel

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

func (ListModel) Init

func (m ListModel) Init() tea.Cmd

func (ListModel) Update

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

func (ListModel) View

func (m ListModel) View() string

type Rank

type Rank struct {
	Index          int
	MatchedIndexes []int
}

func DefaultFilter

func DefaultFilter(term string, targets []string) []Rank

Jump to

Keyboard shortcuts

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