ui

package
v0.30.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BubbleteaUI

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

BubbleteaUI implementation of the UI Provider interface.

func New

func New() *BubbleteaUI

New creates a new UI instance using bubbletea

func NewWithOptions

func NewWithOptions(stdout, stderr io.Writer, input io.Reader) *BubbleteaUI

NewWithOptions creates a new UI instance with custom options for testing

func (*BubbleteaUI) Confirm

func (ui *BubbleteaUI) Confirm(prompt string, defaultValue bool) (bool, error)

Confirm asks a yes/no question and returns the user's choice

func (*BubbleteaUI) FilterableSelect

func (ui *BubbleteaUI) FilterableSelect(prompt string, options []string) (int, string, error)

FilterableSelect presents a filterable list of options and returns the selected index and value

func (*BubbleteaUI) NewLine

func (ui *BubbleteaUI) NewLine()

NewLine prints a blank line

func (*BubbleteaUI) RunWithSpinner

func (ui *BubbleteaUI) RunWithSpinner(message string, operation func() error) error

RunWithSpinner runs a function with a bubbletea spinner

func (*BubbleteaUI) Select

func (ui *BubbleteaUI) Select(prompt string, options []string) (int, string, error)

Select presents a list of options and returns the selected index and value

func (*BubbleteaUI) ShowError

func (ui *BubbleteaUI) ShowError(err error)

ShowError prints an error message to stderr

func (*BubbleteaUI) ShowHeading

func (ui *BubbleteaUI) ShowHeading(message string)

ShowHeading displays a heading/section title

func (*BubbleteaUI) ShowInfo

func (ui *BubbleteaUI) ShowInfo(message string)

ShowInfo displays an informational message (no emoji, no special formatting)

func (*BubbleteaUI) ShowJSON

func (ui *BubbleteaUI) ShowJSON(data any) error

ShowJSON displays formatted JSON output

func (*BubbleteaUI) ShowKeyValue

func (ui *BubbleteaUI) ShowKeyValue(key, value string)

ShowKeyValue displays a key-value pair with bold key

func (*BubbleteaUI) ShowProgress

func (ui *BubbleteaUI) ShowProgress(message string) func()

ShowProgress displays a progress indicator (spinning dots) and returns a function to stop it

func (*BubbleteaUI) ShowSection

func (ui *BubbleteaUI) ShowSection(heading string, lines ...string)

ShowSection displays a section block with heading and indented content

func (*BubbleteaUI) ShowSuccess

func (ui *BubbleteaUI) ShowSuccess(message string)

ShowSuccess displays a success message

func (*BubbleteaUI) ShowYAML

func (ui *BubbleteaUI) ShowYAML(data any) error

ShowYAML displays formatted YAML output

func (*BubbleteaUI) TextInput

func (ui *BubbleteaUI) TextInput(prompt string, defaultValue string, validator func(string) error) (string, error)

TextInput prompts for text input with optional validation

func (*BubbleteaUI) Title

func (ui *BubbleteaUI) Title(message string)

Title displays a large title with extra spacing

type FilterableSelectModel

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

FilterableSelectModel implements a bubbletea model for filterable selection with a visible text input

func (FilterableSelectModel) Init

func (m FilterableSelectModel) Init() tea.Cmd

Init initializes the filterable select model with cursor blink

func (FilterableSelectModel) Update

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

Update handles input events for the filterable select model

func (FilterableSelectModel) View

func (m FilterableSelectModel) View() string

View renders the filterable select model

type Option

type Option struct {
	Label       string
	Value       string
	Description string
}

Option represents a selectable option with additional details

type Provider

type Provider interface {
	// Select presents a list of options and returns the selected index and value
	Select(prompt string, options []string) (int, string, error)

	// FilterableSelect presents a filterable list of options and returns the selected index and value
	FilterableSelect(prompt string, options []string) (int, string, error)

	// TextInput prompts for text input with optional validation
	TextInput(prompt string, defaultValue string, validator func(string) error) (string, error)

	// Confirm asks a yes/no question
	Confirm(prompt string, defaultValue bool) (bool, error)

	// ShowProgress displays a progress indicator with a message
	ShowProgress(message string) func()

	// RunWithSpinner runs a function with a bubbletea spinner
	RunWithSpinner(message string, operation func() error) error

	// ShowInfo displays an informational message (no emoji, no special formatting)
	ShowInfo(message string)

	// Title displays a large title with extra spacing
	Title(message string)

	// ShowHeading displays a heading/section title
	ShowHeading(message string)

	// ShowSection displays a section block with heading and indented content
	ShowSection(heading string, lines ...string)

	// ShowKeyValue displays a key-value pair with bold key
	ShowKeyValue(key, value string)

	// NewLine prints a blank line
	NewLine()

	// ShowError displays an error message
	ShowError(err error)

	// ShowSuccess displays a success message
	ShowSuccess(message string)

	// ShowJSON displays formatted JSON output
	ShowJSON(data any) error

	// ShowYAML displays formatted YAML output
	ShowYAML(data any) error
}

Provider provides interactive terminal UI components

type SelectModel

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

SelectModel implements a bubbletea model for selecting from a list

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

Init initializes the select model

func (SelectModel) Update

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

Update handles input events for the select model

func (SelectModel) View

func (m SelectModel) View() string

View renders the select model

type SpinnerModel

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

SpinnerModel implements a bubbletea model for showing progress

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model with tick animation

func (SpinnerModel) Update

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

Update handles input events for the spinner model

func (SpinnerModel) View

func (m SpinnerModel) View() string

View renders the spinner model

type TextInputModel

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

TextInputModel implements a bubbletea model for text input

func (TextInputModel) Init

func (m TextInputModel) Init() tea.Cmd

Init initializes the text input model with cursor blink

func (TextInputModel) Update

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

Update handles input events for the text input model

func (TextInputModel) View

func (m TextInputModel) View() string

View renders the text input model

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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