uiutils

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PromptKeys = []key.Binding{
	key.NewBinding(
		key.WithKeys("up", "k", "ctrl+p"),
		key.WithHelp("↑/k", "move up"),
	),
	key.NewBinding(
		key.WithKeys("down", "j", "ctrl+n"),
		key.WithHelp("↓/j", "move down"),
	),
	key.NewBinding(
		key.WithKeys("space", "enter"),
		key.WithHelp("space/enter", "select"),
	),
	key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "cancel"),
	),
}

Functions

func ErrCmd added in v0.1.12

func ErrCmd(err error) tea.Cmd

ErrCmd wraps an error into a tea.Cmd that returns the error as a message.

Throughout the application, we capture error as a message and use it as a mean to halt the application. This is a convenience function to trigger that behavior.

func NewLegacyPromptModel added in v0.1.12

func NewLegacyPromptModel(title string, items []string) *selection.Model[string]

func RunBubbleTea added in v0.0.40

func RunBubbleTea(model BubbleTeaModelWithExitHandling) error

Types

type BubbleTeaModelWithExitHandling added in v0.0.40

type BubbleTeaModelWithExitHandling interface {
	// ExitError is called after finish running the program (tea.Quit).
	//
	// This is used as a return value of RunBubbleTea.
	ExitError() error

	tea.Model
}

type NewlineModel added in v0.1.12

type NewlineModel struct {
	Model tea.Model
}

func (*NewlineModel) Init added in v0.1.12

func (m *NewlineModel) Init() tea.Cmd

func (*NewlineModel) Update added in v0.1.12

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

func (*NewlineModel) View added in v0.1.12

func (m *NewlineModel) View() string

type PromptModel added in v0.1.12

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

func NewPromptModel

func NewPromptModel(title string, items []string, callback func(string) tea.Cmd) *PromptModel

func (*PromptModel) Init added in v0.1.12

func (m *PromptModel) Init() tea.Cmd

func (*PromptModel) Update added in v0.1.12

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

func (*PromptModel) View added in v0.1.12

func (m *PromptModel) View() string

type SimpleMessageView added in v0.1.12

type SimpleMessageView struct {
	Message string
}

func (SimpleMessageView) Init added in v0.1.12

func (s SimpleMessageView) Init() tea.Cmd

func (SimpleMessageView) Update added in v0.1.12

func (s SimpleMessageView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SimpleMessageView) View added in v0.1.12

func (s SimpleMessageView) View() string

Jump to

Keyboard shortcuts

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