ui
import "github.com/tagoro9/fotingo/internal/ui"
Package ui provides reusable Bubble Tea primitives shared across interactive commands.
Package ui provides reusable Bubble Tea UI components for the fotingo CLI.
Index
- Variables
- func Confirm(prompt string, defaultYes bool) (bool, error)
- func GetEditor() string
- func HasEditor() bool
- func IssueTypeIcon(issueType string) string
- func OpenEditor(initialContent string) (string, error)
- func OpenEditorOrFallback(initialContent string, fallback string) string
- func OpenEditorWithConfig(config EditorConfig) (string, error)
- func RenderStaticSpinner(message string, completed bool, err error) string
- func SelectIDs(title string, items []MultiSelectItem, minimum int) ([]string, error)
- func SetProgramRunner(runner func(run func() error) error)
- type BrowserProgram
- type ColorScheme
- type ConfirmModel
- type ConfirmOption
- type ConfirmProgram
- type ConfirmResultMsg
- type Editor
- type EditorConfig
- type InputCancelMsg
- type InputModel
- type InputOption
- type InputProgram
- type InputSubmitMsg
- type MultiSelectCancelMsg
- type MultiSelectItem
- type MultiSelectModel
- type MultiSelectOption
- type MultiSelectProgram
- type MultiSelectResultMsg
- type PickerCancelMsg
- type PickerItem
- type PickerModel
- type PickerOption
- type PickerProgram
- type PickerSelectMsg
- type SpinnerCompleteStepMsg
- type SpinnerDoneMsg
- type SpinnerModel
- type SpinnerOption
- type SpinnerProgram
- type SpinnerStep
- type SpinnerStepMsg
- type SpinnerUpdateMsg
- type Styles
- type ValidationFunc
Variables
ErrEditorEmpty is returned when the editor content is empty.
var ErrEditorEmpty = errors.New(i18n.T(i18n.UIErrEditorEmpty))
ErrEditorFailed is returned when the editor exits with an error.
var ErrEditorFailed = errors.New(i18n.T(i18n.UIErrEditorFailed))
ErrNoEditor is returned when no editor is available.
var ErrNoEditor = errors.New(i18n.T(i18n.UIErrNoEditor))
Icons provides consistent unicode icons for UI elements.
var Icons = struct {
// Issue type icons
Bug string
Story string
Task string
Epic string
Subtask string
Improvement string
NewFeature string
Unknown string
// Status icons
Check string
Cross string
Warning string
Info string
Question string
// UI icons
Cursor string
Checkbox string
Selected string
Arrow string
Spinner string
Ellipsis string
Separator string
}{
Bug: "[B]",
Story: "[S]",
Task: "[T]",
Epic: "[E]",
Subtask: "[s]",
Improvement: "[I]",
NewFeature: "[N]",
Unknown: "[?]",
Check: "[v]",
Cross: "[x]",
Warning: "[!]",
Info: "[i]",
Question: "[?]",
Cursor: ">",
Checkbox: "[ ]",
Selected: "[x]",
Arrow: "->",
Spinner: "*",
Ellipsis: "...",
Separator: "|",
}
Spacing provides consistent spacing values.
var Spacing = struct {
None int
Small int
Medium int
Large int
}{
None: 0,
Small: 1,
Medium: 2,
Large: 4,
}
func Confirm(prompt string, defaultYes bool) (bool, error)
Confirm is a helper function to show a confirmation prompt and return the result.
func GetEditor() string
GetEditor returns the path to the editor command.
func HasEditor() bool
HasEditor returns true if an editor is available.
func IssueTypeIcon(issueType string) string
IssueTypeIcon returns the appropriate icon for a Jira issue type.
func OpenEditor(initialContent string) (string, error)
OpenEditor is a convenience function to open an editor with content and return the result.
func OpenEditorOrFallback(initialContent string, fallback string) string
OpenEditorOrFallback opens an editor if available, otherwise returns the fallback content.
func OpenEditorWithConfig(config EditorConfig) (string, error)
OpenEditorWithConfig is a convenience function to open an editor with custom config.
func RenderStaticSpinner(message string, completed bool, err error) string
RenderStaticSpinner renders a non-animated spinner view for non-TTY output.
func SelectIDs(title string, items []MultiSelectItem, minimum int) ([]string, error)
SelectIDs renders a shared multi-select prompt and returns selected item IDs.
func SetProgramRunner(runner func(run func() error) error)
SetProgramRunner configures an optional wrapper for interactive TUI program execution. Passing nil resets to direct execution.
BrowserProgram provides a list/detail interactive browser experience. Enter opens details for the selected item. Escape goes back to the list. Escape on the list exits the browser.
type BrowserProgram struct {
// contains filtered or unexported fields
}
func NewBrowserProgram(title string, items []PickerItem, renderDetail func(PickerItem) string) *BrowserProgram
NewBrowserProgram creates a browser program for list/detail navigation.
func (*BrowserProgram) Run
func (bp *BrowserProgram) Run() error
Run executes the browser program.
ColorScheme defines the color palette for UI components.
type ColorScheme struct {
// Primary colors
Primary lipgloss.TerminalColor
Secondary lipgloss.TerminalColor
Accent lipgloss.TerminalColor
// Status colors
Success lipgloss.TerminalColor
Warning lipgloss.TerminalColor
Error lipgloss.TerminalColor
Info lipgloss.TerminalColor
// UI colors
Border lipgloss.TerminalColor
Muted lipgloss.TerminalColor
Background lipgloss.TerminalColor
Foreground lipgloss.TerminalColor
// Selection colors
Selected lipgloss.TerminalColor
Unselected lipgloss.TerminalColor
Cursor lipgloss.TerminalColor
}
func DarkScheme() ColorScheme
DarkScheme returns the color scheme for dark terminals.
func DefaultScheme() ColorScheme
DefaultScheme returns the appropriate color scheme based on terminal settings. It respects NO_COLOR environment variable.
func LightScheme() ColorScheme
LightScheme returns the color scheme for light terminals.
ConfirmModel represents a y/n confirmation prompt.
type ConfirmModel struct {
// contains filtered or unexported fields
}
func NewConfirm(opts ...ConfirmOption) ConfirmModel
NewConfirm creates a new ConfirmModel.
func (ConfirmModel) Cancelled
func (m ConfirmModel) Cancelled() bool
Cancelled returns whether the prompt was cancelled.
func (ConfirmModel) Confirmed
func (m ConfirmModel) Confirmed() bool
Confirmed returns whether Yes was selected.
func (ConfirmModel) Init
func (m ConfirmModel) Init() tea.Cmd
Init initializes the confirmation model.
func (ConfirmModel) Selected
func (m ConfirmModel) Selected() bool
Selected returns the current selection (true = Yes, false = No).
func (ConfirmModel) Update
func (m ConfirmModel) Update(msg tea.Msg) (ConfirmModel, tea.Cmd)
Update handles messages for the confirmation model.
func (ConfirmModel) View
func (m ConfirmModel) View() string
View renders the confirmation prompt.
ConfirmOption configures a ConfirmModel.
type ConfirmOption func(*ConfirmModel)
func WithConfirmPrompt(prompt string) ConfirmOption
WithConfirmPrompt sets the confirmation prompt text.
func WithConfirmStyles(styles Styles) ConfirmOption
WithConfirmStyles sets custom styles for the confirmation.
func WithDefaultNo() ConfirmOption
WithDefaultNo sets the default selection to No.
func WithDefaultYes() ConfirmOption
WithDefaultYes sets the default selection to Yes.
func WithShowButtons() ConfirmOption
WithShowButtons enables button-style display.
ConfirmProgram wraps a ConfirmModel in a tea.Program for standalone use.
type ConfirmProgram struct {
// contains filtered or unexported fields
}
func NewConfirmProgram(opts ...ConfirmOption) *ConfirmProgram
NewConfirmProgram creates a new confirmation program for standalone operation.
func (*ConfirmProgram) Run
func (cp *ConfirmProgram) Run() (confirmed bool, cancelled bool, err error)
Run runs the confirmation program and returns the result.
ConfirmResultMsg is sent when the confirmation is resolved.
type ConfirmResultMsg struct {
Confirmed bool
Cancelled bool
}
Editor provides functionality to open an external editor.
type Editor struct {
// contains filtered or unexported fields
}
func NewEditor(config EditorConfig) (*Editor, error)
NewEditor creates a new Editor instance.
func (*Editor) Edit
func (e *Editor) Edit() (string, error)
Edit opens the editor with the initial content and returns the edited content.
func (e *Editor) FilePath() string
FilePath returns the path of the temp file (useful if DeleteOnClose is false).
EditorConfig configures the editor behavior.
type EditorConfig struct {
// Extension is the file extension for the temp file (default: ".md")
Extension string
// InitialContent is the initial content to show in the editor
InitialContent string
// Prefix is a prefix for the temp file name
Prefix string
// AllowEmpty if true, allows empty content to be returned
AllowEmpty bool
// DeleteOnClose if true, deletes the temp file after editing
DeleteOnClose bool
}
func DefaultEditorConfig() EditorConfig
DefaultEditorConfig returns the default editor configuration.
InputCancelMsg is sent when the input is cancelled.
type InputCancelMsg struct{}
InputModel represents a styled text input with validation support.
type InputModel struct {
// contains filtered or unexported fields
}
func NewInput(opts ...InputOption) InputModel
NewInput creates a new InputModel.
func (m *InputModel) Blur()
Blur removes focus from the input.
func (m InputModel) Cancelled() bool
Cancelled returns whether the input was cancelled.
func (m InputModel) Error() error
Error returns any validation error.
func (m *InputModel) Focus() tea.Cmd
Focus focuses the input.
func (m InputModel) Init() tea.Cmd
Init initializes the input model.
func (m *InputModel) Reset()
Reset resets the input state.
func (m *InputModel) SetValue(value string)
SetValue sets the input value.
func (m InputModel) Submitted() bool
Submitted returns whether the input was submitted.
func (m InputModel) Update(msg tea.Msg) (InputModel, tea.Cmd)
Update handles messages for the input model.
func (m InputModel) Value() string
Value returns the current input value.
func (m InputModel) View() string
View renders the input.
InputOption configures an InputModel.
type InputOption func(*InputModel)
func WithCharLimit(limit int) InputOption
WithCharLimit sets the character limit.
func WithInitialValue(value string) InputOption
WithInitialValue sets the initial input value.
func WithInputStyles(styles Styles) InputOption
WithInputStyles sets custom styles for the input.
func WithMasked() InputOption
WithMasked enables password masking mode.
func WithMultiline(height int) InputOption
WithMultiline enables wrapped multiline input.
func WithPlaceholder(placeholder string) InputOption
WithPlaceholder sets the placeholder text.
func WithPrompt(prompt string) InputOption
WithPrompt sets the input prompt text.
func WithValidation(fn ValidationFunc) InputOption
WithValidation sets the validation function.
func WithWidth(width int) InputOption
WithWidth sets the input width.
InputProgram wraps an InputModel in a tea.Program for standalone use.
type InputProgram struct {
// contains filtered or unexported fields
}
func NewInputProgram(opts ...InputOption) *InputProgram
NewInputProgram creates a new input program for standalone operation.
func (ip *InputProgram) Run() (string, error)
Run runs the input program and returns the entered value.
func (ip *InputProgram) RunWithCancel() (value string, cancelled bool, err error)
RunWithCancel runs the input program and returns the entered value and cancellation status.
InputSubmitMsg is sent when the input is submitted.
type InputSubmitMsg struct {
Value string
}
MultiSelectCancelMsg is sent when the multi-select is cancelled.
type MultiSelectCancelMsg struct{}
MultiSelectItem represents a selection candidate used by shared multi-select helpers.
type MultiSelectItem struct {
ID string
Label string
Detail string
Icon string
}
MultiSelectModel represents a multi-select picker with fuzzy search filtering.
type MultiSelectModel struct {
// contains filtered or unexported fields
}
func NewMultiSelect(opts ...MultiSelectOption) MultiSelectModel
NewMultiSelect creates a new MultiSelectModel.
func (MultiSelectModel) Cancelled
func (m MultiSelectModel) Cancelled() bool
Cancelled returns whether the selection was cancelled.
func (MultiSelectModel) Init
func (m MultiSelectModel) Init() tea.Cmd
Init initializes the multi-select model.
func (MultiSelectModel) Items
func (m MultiSelectModel) Items() []PickerItem
Items returns all items.
func (m MultiSelectModel) SelectedItems() []PickerItem
SelectedItems returns all selected items.
func (*MultiSelectModel) SetItems
func (m *MultiSelectModel) SetItems(items []PickerItem)
SetItems updates the items and resets the filter.
func (MultiSelectModel) Submitted
func (m MultiSelectModel) Submitted() bool
Submitted returns whether the selection was confirmed.
func (MultiSelectModel) Update
func (m MultiSelectModel) Update(msg tea.Msg) (MultiSelectModel, tea.Cmd)
Update handles messages for the multi-select model.
func (MultiSelectModel) View
func (m MultiSelectModel) View() string
View renders the multi-select.
MultiSelectOption configures a MultiSelectModel.
type MultiSelectOption func(*MultiSelectModel)
func WithMultiSelectHeight(height int) MultiSelectOption
WithMultiSelectHeight sets the maximum visible items.
func WithMultiSelectItems(items []PickerItem) MultiSelectOption
WithMultiSelectItems sets the initial items.
func WithMultiSelectMaximum(max int) MultiSelectOption
WithMultiSelectMaximum sets the maximum allowed selections.
func WithMultiSelectMinimum(min int) MultiSelectOption
WithMultiSelectMinimum sets the minimum required selections.
func WithMultiSelectSearch(enabled bool) MultiSelectOption
WithMultiSelectSearch enables or disables the search input.
func WithMultiSelectStyles(styles Styles) MultiSelectOption
WithMultiSelectStyles sets custom styles.
func WithMultiSelectTitle(title string) MultiSelectOption
WithMultiSelectTitle sets the title.
func WithPreselected(ids []string) MultiSelectOption
WithPreselected marks specific items as selected by their IDs.
MultiSelectProgram wraps a MultiSelectModel in a tea.Program for standalone use.
type MultiSelectProgram struct {
// contains filtered or unexported fields
}
func NewMultiSelectProgram(opts ...MultiSelectOption) *MultiSelectProgram
NewMultiSelectProgram creates a new multi-select program for standalone operation.
func (*MultiSelectProgram) Run
func (mp *MultiSelectProgram) Run() ([]PickerItem, error)
Run runs the multi-select program and returns the selected items.
MultiSelectResultMsg is sent when the multi-select is confirmed.
type MultiSelectResultMsg struct {
Items []PickerItem
}
PickerCancelMsg is sent when the picker is cancelled.
type PickerCancelMsg struct{}
PickerItem represents an item in the picker.
type PickerItem struct {
ID string // Unique identifier
Label string // Display text
Detail string // Additional detail (displayed after label)
Icon string // Optional icon prefix
Selected bool // For multi-select mode
Value any // Optional associated value
}
func SelectOne(title string, items []PickerItem) (*PickerItem, error)
SelectOne renders a searchable single-select picker and returns the selected item.
PickerModel represents a list picker with fuzzy search filtering.
type PickerModel struct {
// contains filtered or unexported fields
}
func NewPicker(opts ...PickerOption) PickerModel
NewPicker creates a new PickerModel.
func (PickerModel) Cancelled
func (m PickerModel) Cancelled() bool
Cancelled returns whether the picker was cancelled.
func (PickerModel) Init
func (m PickerModel) Init() tea.Cmd
Init initializes the picker model.
func (PickerModel) Items
func (m PickerModel) Items() []PickerItem
Items returns all items.
func (m PickerModel) SelectedItem() *PickerItem
SelectedItem returns the currently highlighted item, or nil if none.
func (*PickerModel) SetItems
func (m *PickerModel) SetItems(items []PickerItem)
SetItems updates the items and resets the filter.
func (PickerModel) Submitted
func (m PickerModel) Submitted() bool
Submitted returns whether an item was selected.
func (PickerModel) Update
func (m PickerModel) Update(msg tea.Msg) (PickerModel, tea.Cmd)
Update handles messages for the picker model.
func (PickerModel) View
func (m PickerModel) View() string
View renders the picker.
PickerOption configures a PickerModel.
type PickerOption func(*PickerModel)
func WithPickerHeight(height int) PickerOption
WithPickerHeight sets the maximum visible items.
func WithPickerItems(items []PickerItem) PickerOption
WithPickerItems sets the initial items.
func WithPickerSearch(enabled bool) PickerOption
WithPickerSearch enables or disables the search input.
func WithPickerStyles(styles Styles) PickerOption
WithPickerStyles sets custom styles.
func WithPickerTitle(title string) PickerOption
WithPickerTitle sets the picker title.
PickerProgram wraps a PickerModel in a tea.Program for standalone use.
type PickerProgram struct {
// contains filtered or unexported fields
}
func NewPickerProgram(opts ...PickerOption) *PickerProgram
NewPickerProgram creates a new picker program for standalone operation.
func (*PickerProgram) Run
func (pp *PickerProgram) Run() (*PickerItem, error)
Run runs the picker program and returns the selected item.
PickerSelectMsg is sent when an item is selected.
type PickerSelectMsg struct {
Item PickerItem
}
SpinnerCompleteStepMsg marks the current step as completed.
type SpinnerCompleteStepMsg struct {
Error error
}
SpinnerDoneMsg signals that the spinner should stop.
type SpinnerDoneMsg struct {
Error error
}
SpinnerModel represents a progress spinner with optional multi-step display.
type SpinnerModel struct {
// contains filtered or unexported fields
}
func NewSpinner(opts ...SpinnerOption) SpinnerModel
NewSpinner creates a new SpinnerModel.
func (*SpinnerModel) AddStep
func (m *SpinnerModel) AddStep(msg string)
AddStep adds a new step to the multi-step progress display.
func (m *SpinnerModel) CompleteStep(err error)
CompleteStep marks the current step as completed.
func (SpinnerModel) Done
func (m SpinnerModel) Done() bool
Done returns whether the spinner has completed.
func (SpinnerModel) Error
func (m SpinnerModel) Error() error
Error returns any error that occurred.
func (*SpinnerModel) Finish
func (m *SpinnerModel) Finish(err error)
Finish marks the spinner as done.
func (SpinnerModel) Init
func (m SpinnerModel) Init() tea.Cmd
Init initializes the spinner model.
func (*SpinnerModel) SetMessage
func (m *SpinnerModel) SetMessage(msg string)
SetMessage sets the current message.
func (SpinnerModel) Update
func (m SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)
Update handles messages for the spinner model.
func (SpinnerModel) View
func (m SpinnerModel) View() string
View renders the spinner.
SpinnerOption configures a SpinnerModel.
type SpinnerOption func(*SpinnerModel)
func WithMessage(msg string) SpinnerOption
WithMessage sets the initial message.
func WithSpinnerStyle(s spinner.Spinner) SpinnerOption
WithSpinnerStyle sets the spinner animation style.
func WithStyles(styles Styles) SpinnerOption
WithStyles sets custom styles for the spinner.
SpinnerProgram wraps a SpinnerModel in a tea.Program for standalone use.
type SpinnerProgram struct {
// contains filtered or unexported fields
}
func NewSpinnerProgram(opts ...SpinnerOption) *SpinnerProgram
NewSpinnerProgram creates a new spinner program for standalone operation.
func (*SpinnerProgram) AddStep
func (sp *SpinnerProgram) AddStep(msg string)
AddStep adds a new step to the spinner.
func (sp *SpinnerProgram) CompleteStep(err error)
CompleteStep completes the current step.
func (*SpinnerProgram) Done
func (sp *SpinnerProgram) Done(err error)
Done signals completion and stops the spinner.
func (*SpinnerProgram) Start
func (sp *SpinnerProgram) Start() error
Start starts the spinner program in the background.
func (sp *SpinnerProgram) UpdateMessage(msg string)
UpdateMessage sends a message update to the spinner.
func (*SpinnerProgram) Wait
func (sp *SpinnerProgram) Wait() error
Wait blocks until the program exits.
SpinnerStep represents a single step in a multi-step progress display.
type SpinnerStep struct {
Message string
Completed bool
Error error
}
SpinnerStepMsg adds a new step to the spinner.
type SpinnerStepMsg struct {
Message string
}
SpinnerUpdateMsg updates the spinner message.
type SpinnerUpdateMsg string
Styles provides a collection of reusable Lipgloss styles.
type Styles struct {
// Base styles
Base lipgloss.Style
// Title and header styles
Title lipgloss.Style
Subtitle lipgloss.Style
Header lipgloss.Style
// Content styles
Normal lipgloss.Style
Bold lipgloss.Style
Muted lipgloss.Style
Highlight lipgloss.Style
// Status styles
Success lipgloss.Style
Warning lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
// List/Picker styles
ListItem lipgloss.Style
ListItemSelected lipgloss.Style
ListCursor lipgloss.Style
// Input styles
InputPrompt lipgloss.Style
InputText lipgloss.Style
InputPlaceholder lipgloss.Style
// Border styles
BorderedBox lipgloss.Style
// Spinner styles
Spinner lipgloss.Style
// Button styles
ButtonActive lipgloss.Style
ButtonInactive lipgloss.Style
// Checkbox styles
CheckboxChecked lipgloss.Style
CheckboxUnchecked lipgloss.Style
// Help styles
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
// contains filtered or unexported fields
}
func DefaultStyles() Styles
DefaultStyles returns a new Styles instance with the default color scheme.
func NewStyles(scheme ColorScheme) Styles
NewStyles creates a new Styles instance with the given color scheme.
func (Styles) Scheme
func (s Styles) Scheme() ColorScheme
Scheme returns the color scheme used by these styles.
ValidationFunc is a function that validates input and returns an error message if invalid.
type ValidationFunc func(value string) error
Generated by gomarkdoc
`go
import "github.com/tagoro9/fotingo/internal/ui"
Package ui provides reusable Bubble Tea UI components for the fotingo CLI.
## Index
- [Variables](<#variables>)
- [func Confirm\(prompt string, defaultYes bool\) \(bool, error\)](<#Confirm>)
- [func GetEditor\(\) string](<#GetEditor>)
- [func HasEditor\(\) bool](<#HasEditor>)
- [func IssueTypeIcon\(issueType string\) string](<#IssueTypeIcon>)
- [func OpenEditor\(initialContent string\) \(string, error\)](<#OpenEditor>)
- [func OpenEditorOrFallback\(initialContent string, fallback string\) string](<#OpenEditorOrFallback>)
- [func OpenEditorWithConfig\(config EditorConfig\) \(string, error\)](<#OpenEditorWithConfig>)
- [func RenderStaticSpinner\(message string, completed bool, err error\) string](<#RenderStaticSpinner>)
- [type ColorScheme](<#ColorScheme>)
- [func DarkScheme\(\) ColorScheme](<#DarkScheme>)
- [func DefaultScheme\(\) ColorScheme](<#DefaultScheme>)
- [func LightScheme\(\) ColorScheme](<#LightScheme>)
- [type ConfirmModel](<#ConfirmModel>)
- [func NewConfirm\(opts ...ConfirmOption\) ConfirmModel](<#NewConfirm>)
- [func \(m ConfirmModel\) Cancelled\(\) bool](<#ConfirmModel.Cancelled>)
- [func \(m ConfirmModel\) Confirmed\(\) bool](<#ConfirmModel.Confirmed>)
- [func \(m ConfirmModel\) Init\(\) tea.Cmd](<#ConfirmModel.Init>)
- [func \(m ConfirmModel\) Selected\(\) bool](<#ConfirmModel.Selected>)
- [func \(m ConfirmModel\) Update\(msg tea.Msg\) \(ConfirmModel, tea.Cmd\)](<#ConfirmModel.Update>)
- [func \(m ConfirmModel\) View\(\) string](<#ConfirmModel.View>)
- [type ConfirmOption](<#ConfirmOption>)
- [func WithConfirmPrompt\(prompt string\) ConfirmOption](<#WithConfirmPrompt>)
- [func WithConfirmStyles\(styles Styles\) ConfirmOption](<#WithConfirmStyles>)
- [func WithDefaultNo\(\) ConfirmOption](<#WithDefaultNo>)
- [func WithDefaultYes\(\) ConfirmOption](<#WithDefaultYes>)
- [func WithShowButtons\(\) ConfirmOption](<#WithShowButtons>)
- [type ConfirmProgram](<#ConfirmProgram>)
- [func NewConfirmProgram\(opts ...ConfirmOption\) \*ConfirmProgram](<#NewConfirmProgram>)
- [func \(cp \*ConfirmProgram\) Run\(\) \(confirmed bool, cancelled bool, err error\)](<#ConfirmProgram.Run>)
- [type ConfirmResultMsg](<#ConfirmResultMsg>)
- [type Editor](<#Editor>)
- [func NewEditor\(config EditorConfig\) \(\*Editor, error\)](<#NewEditor>)
- [func \(e \*Editor\) Edit\(\) \(string, error\)](<#Editor.Edit>)
- [func \(e \*Editor\) FilePath\(\) string](<#Editor.FilePath>)
- [type EditorConfig](<#EditorConfig>)
- [func DefaultEditorConfig\(\) EditorConfig](<#DefaultEditorConfig>)
- [type InputCancelMsg](<#InputCancelMsg>)
- [type InputModel](<#InputModel>)
- [func NewInput\(opts ...InputOption\) InputModel](<#NewInput>)
- [func \(m \*InputModel\) Blur\(\)](<#InputModel.Blur>)
- [func \(m InputModel\) Cancelled\(\) bool](<#InputModel.Cancelled>)
- [func \(m InputModel\) Error\(\) error](<#InputModel.Error>)
- [func \(m \*InputModel\) Focus\(\) tea.Cmd](<#InputModel.Focus>)
- [func \(m InputModel\) Init\(\) tea.Cmd](<#InputModel.Init>)
- [func \(m \*InputModel\) Reset\(\)](<#InputModel.Reset>)
- [func \(m \*InputModel\) SetValue\(value string\)](<#InputModel.SetValue>)
- [func \(m InputModel\) Submitted\(\) bool](<#InputModel.Submitted>)
- [func \(m InputModel\) Update\(msg tea.Msg\) \(InputModel, tea.Cmd\)](<#InputModel.Update>)
- [func \(m InputModel\) Value\(\) string](<#InputModel.Value>)
- [func \(m InputModel\) View\(\) string](<#InputModel.View>)
- [type InputOption](<#InputOption>)
- [func WithCharLimit\(limit int\) InputOption](<#WithCharLimit>)
- [func WithInitialValue\(value string\) InputOption](<#WithInitialValue>)
- [func WithInputStyles\(styles Styles\) InputOption](<#WithInputStyles>)
- [func WithMasked\(\) InputOption](<#WithMasked>)
- [func WithPlaceholder\(placeholder string\) InputOption](<#WithPlaceholder>)
- [func WithPrompt\(prompt string\) InputOption](<#WithPrompt>)
- [func WithValidation\(fn ValidationFunc\) InputOption](<#WithValidation>)
- [func WithWidth\(width int\) InputOption](<#WithWidth>)
- [type InputProgram](<#InputProgram>)
- [func NewInputProgram\(opts ...InputOption\) \*InputProgram](<#NewInputProgram>)
- [func \(ip \*InputProgram\) Run\(\) \(string, error\)](<#InputProgram.Run>)
- [func \(ip \*InputProgram\) RunWithCancel\(\) \(value string, cancelled bool, err error\)](<#InputProgram.RunWithCancel>)
- [type InputSubmitMsg](<#InputSubmitMsg>)
- [type MultiSelectCancelMsg](<#MultiSelectCancelMsg>)
- [type MultiSelectModel](<#MultiSelectModel>)
- [func NewMultiSelect\(opts ...MultiSelectOption\) MultiSelectModel](<#NewMultiSelect>)
- [func \(m MultiSelectModel\) Cancelled\(\) bool](<#MultiSelectModel.Cancelled>)
- [func \(m MultiSelectModel\) Init\(\) tea.Cmd](<#MultiSelectModel.Init>)
- [func \(m MultiSelectModel\) Items\(\) \[\]PickerItem](<#MultiSelectModel.Items>)
- [func \(m MultiSelectModel\) SelectedItems\(\) \[\]PickerItem](<#MultiSelectModel.SelectedItems>)
- [func \(m \*MultiSelectModel\) SetItems\(items \[\]PickerItem\)](<#MultiSelectModel.SetItems>)
- [func \(m MultiSelectModel\) Submitted\(\) bool](<#MultiSelectModel.Submitted>)
- [func \(m MultiSelectModel\) Update\(msg tea.Msg\) \(MultiSelectModel, tea.Cmd\)](<#MultiSelectModel.Update>)
- [func \(m MultiSelectModel\) View\(\) string](<#MultiSelectModel.View>)
- [type MultiSelectOption](<#MultiSelectOption>)
- [func WithMultiSelectHeight\(height int\) MultiSelectOption](<#WithMultiSelectHeight>)
- [func WithMultiSelectItems\(items \[\]PickerItem\) MultiSelectOption](<#WithMultiSelectItems>)
- [func WithMultiSelectMaximum\(max int\) MultiSelectOption](<#WithMultiSelectMaximum>)
- [func WithMultiSelectMinimum\(min int\) MultiSelectOption](<#WithMultiSelectMinimum>)
- [func WithMultiSelectSearch\(enabled bool\) MultiSelectOption](<#WithMultiSelectSearch>)
- [func WithMultiSelectStyles\(styles Styles\) MultiSelectOption](<#WithMultiSelectStyles>)
- [func WithMultiSelectTitle\(title string\) MultiSelectOption](<#WithMultiSelectTitle>)
- [func WithPreselected\(ids \[\]string\) MultiSelectOption](<#WithPreselected>)
- [type MultiSelectProgram](<#MultiSelectProgram>)
- [func NewMultiSelectProgram\(opts ...MultiSelectOption\) \*MultiSelectProgram](<#NewMultiSelectProgram>)
- [func \(mp \*MultiSelectProgram\) Run\(\) \(\[\]PickerItem, error\)](<#MultiSelectProgram.Run>)
- [type MultiSelectResultMsg](<#MultiSelectResultMsg>)
- [type PickerCancelMsg](<#PickerCancelMsg>)
- [type PickerItem](<#PickerItem>)
- [type PickerModel](<#PickerModel>)
- [func NewPicker\(opts ...PickerOption\) PickerModel](<#NewPicker>)
- [func \(m PickerModel\) Cancelled\(\) bool](<#PickerModel.Cancelled>)
- [func \(m PickerModel\) Init\(\) tea.Cmd](<#PickerModel.Init>)
- [func \(m PickerModel\) Items\(\) \[\]PickerItem](<#PickerModel.Items>)
- [func \(m PickerModel\) SelectedItem\(\) \*PickerItem](<#PickerModel.SelectedItem>)
- [func \(m \*PickerModel\) SetItems\(items \[\]PickerItem\)](<#PickerModel.SetItems>)
- [func \(m PickerModel\) Submitted\(\) bool](<#PickerModel.Submitted>)
- [func \(m PickerModel\) Update\(msg tea.Msg\) \(PickerModel, tea.Cmd\)](<#PickerModel.Update>)
- [func \(m PickerModel\) View\(\) string](<#PickerModel.View>)
- [type PickerOption](<#PickerOption>)
- [func WithPickerHeight\(height int\) PickerOption](<#WithPickerHeight>)
- [func WithPickerItems\(items \[\]PickerItem\) PickerOption](<#WithPickerItems>)
- [func WithPickerSearch\(enabled bool\) PickerOption](<#WithPickerSearch>)
- [func WithPickerStyles\(styles Styles\) PickerOption](<#WithPickerStyles>)
- [func WithPickerTitle\(title string\) PickerOption](<#WithPickerTitle>)
- [type PickerProgram](<#PickerProgram>)
- [func NewPickerProgram\(opts ...PickerOption\) \*PickerProgram](<#NewPickerProgram>)
- [func \(pp \*PickerProgram\) Run\(\) \(\*PickerItem, error\)](<#PickerProgram.Run>)
- [type PickerSelectMsg](<#PickerSelectMsg>)
- [type SpinnerCompleteStepMsg](<#SpinnerCompleteStepMsg>)
- [type SpinnerDoneMsg](<#SpinnerDoneMsg>)
- [type SpinnerModel](<#SpinnerModel>)
- [func NewSpinner\(opts ...SpinnerOption\) SpinnerModel](<#NewSpinner>)
- [func \(m \*SpinnerModel\) AddStep\(msg string\)](<#SpinnerModel.AddStep>)
- [func \(m \*SpinnerModel\) CompleteStep\(err error\)](<#SpinnerModel.CompleteStep>)
- [func \(m SpinnerModel\) Done\(\) bool](<#SpinnerModel.Done>)
- [func \(m SpinnerModel\) Error\(\) error](<#SpinnerModel.Error>)
- [func \(m \*SpinnerModel\) Finish\(err error\)](<#SpinnerModel.Finish>)
- [func \(m SpinnerModel\) Init\(\) tea.Cmd](<#SpinnerModel.Init>)
- [func \(m \*SpinnerModel\) SetMessage\(msg string\)](<#SpinnerModel.SetMessage>)
- [func \(m SpinnerModel\) Update\(msg tea.Msg\) \(SpinnerModel, tea.Cmd\)](<#SpinnerModel.Update>)
- [func \(m SpinnerModel\) View\(\) string](<#SpinnerModel.View>)
- [type SpinnerOption](<#SpinnerOption>)
- [func WithMessage\(msg string\) SpinnerOption](<#WithMessage>)
- [func WithSpinnerStyle\(s spinner.Spinner\) SpinnerOption](<#WithSpinnerStyle>)
- [func WithStyles\(styles Styles\) SpinnerOption](<#WithStyles>)
- [type SpinnerProgram](<#SpinnerProgram>)
- [func NewSpinnerProgram\(opts ...SpinnerOption\) \*SpinnerProgram](<#NewSpinnerProgram>)
- [func \(sp \*SpinnerProgram\) AddStep\(msg string\)](<#SpinnerProgram.AddStep>)
- [func \(sp \*SpinnerProgram\) CompleteStep\(err error\)](<#SpinnerProgram.CompleteStep>)
- [func \(sp \*SpinnerProgram\) Done\(err error\)](<#SpinnerProgram.Done>)
- [func \(sp \*SpinnerProgram\) Start\(\) error](<#SpinnerProgram.Start>)
- [func \(sp \*SpinnerProgram\) UpdateMessage\(msg string\)](<#SpinnerProgram.UpdateMessage>)
- [func \(sp \*SpinnerProgram\) Wait\(\) error](<#SpinnerProgram.Wait>)
- [type SpinnerStep](<#SpinnerStep>)
- [type SpinnerStepMsg](<#SpinnerStepMsg>)
- [type SpinnerUpdateMsg](<#SpinnerUpdateMsg>)
- [type Styles](<#Styles>)
- [func DefaultStyles\(\) Styles](<#DefaultStyles>)
- [func NewStyles\(scheme ColorScheme\) Styles](<#NewStyles>)
- [func \(s Styles\) Scheme\(\) ColorScheme](<#Styles.Scheme>)
- [type ValidationFunc](<#ValidationFunc>)
## Variables
<a name="ErrEditorEmpty"></a>ErrEditorEmpty is returned when the editor content is empty.
```go
var ErrEditorEmpty = errors.New(i18n.T(i18n.UIErrEditorEmpty))
ErrEditorFailed is returned when the editor exits with an error.
var ErrEditorFailed = errors.New(i18n.T(i18n.UIErrEditorFailed))
ErrNoEditor is returned when no editor is available.
var ErrNoEditor = errors.New(i18n.T(i18n.UIErrNoEditor))
Icons provides consistent unicode icons for UI elements.
var Icons = struct {
// Issue type icons
Bug string
Story string
Task string
Epic string
Subtask string
Improvement string
NewFeature string
Unknown string
// Status icons
Check string
Cross string
Warning string
Info string
Question string
// UI icons
Cursor string
Checkbox string
Selected string
Arrow string
Spinner string
Ellipsis string
Separator string
}{
Bug: "[B]",
Story: "[S]",
Task: "[T]",
Epic: "[E]",
Subtask: "[s]",
Improvement: "[I]",
NewFeature: "[N]",
Unknown: "[?]",
Check: "[v]",
Cross: "[x]",
Warning: "[!]",
Info: "[i]",
Question: "[?]",
Cursor: ">",
Checkbox: "[ ]",
Selected: "[x]",
Arrow: "->",
Spinner: "*",
Ellipsis: "...",
Separator: "|",
}
Spacing provides consistent spacing values.
var Spacing = struct {
None int
Small int
Medium int
Large int
}{
None: 0,
Small: 1,
Medium: 2,
Large: 4,
}
func Confirm(prompt string, defaultYes bool) (bool, error)
Confirm is a helper function to show a confirmation prompt and return the result.
func GetEditor() string
GetEditor returns the path to the editor command.
func HasEditor() bool
HasEditor returns true if an editor is available.
func IssueTypeIcon(issueType string) string
IssueTypeIcon returns the appropriate icon for a Jira issue type.
func OpenEditor(initialContent string) (string, error)
OpenEditor is a convenience function to open an editor with content and return the result.
func OpenEditorOrFallback(initialContent string, fallback string) string
OpenEditorOrFallback opens an editor if available, otherwise returns the fallback content.
func OpenEditorWithConfig(config EditorConfig) (string, error)
OpenEditorWithConfig is a convenience function to open an editor with custom config.
func RenderStaticSpinner(message string, completed bool, err error) string
RenderStaticSpinner renders a non-animated spinner view for non-TTY output.
ColorScheme defines the color palette for UI components.
type ColorScheme struct {
// Primary colors
Primary lipgloss.TerminalColor
Secondary lipgloss.TerminalColor
Accent lipgloss.TerminalColor
// Status colors
Success lipgloss.TerminalColor
Warning lipgloss.TerminalColor
Error lipgloss.TerminalColor
Info lipgloss.TerminalColor
// UI colors
Border lipgloss.TerminalColor
Muted lipgloss.TerminalColor
Background lipgloss.TerminalColor
Foreground lipgloss.TerminalColor
// Selection colors
Selected lipgloss.TerminalColor
Unselected lipgloss.TerminalColor
Cursor lipgloss.TerminalColor
}
func DarkScheme() ColorScheme
DarkScheme returns the color scheme for dark terminals.
func DefaultScheme() ColorScheme
DefaultScheme returns the appropriate color scheme based on terminal settings. It respects NO_COLOR environment variable.
func LightScheme() ColorScheme
LightScheme returns the color scheme for light terminals.
ConfirmModel represents a y/n confirmation prompt.
type ConfirmModel struct {
// contains filtered or unexported fields
}
func NewConfirm(opts ...ConfirmOption) ConfirmModel
NewConfirm creates a new ConfirmModel.
func (ConfirmModel) Cancelled
func (m ConfirmModel) Cancelled() bool
Cancelled returns whether the prompt was cancelled.
func (ConfirmModel) Confirmed
func (m ConfirmModel) Confirmed() bool
Confirmed returns whether Yes was selected.
func (ConfirmModel) Init
func (m ConfirmModel) Init() tea.Cmd
Init initializes the confirmation model.
func (ConfirmModel) Selected
func (m ConfirmModel) Selected() bool
Selected returns the current selection (true = Yes, false = No).
func (ConfirmModel) Update
func (m ConfirmModel) Update(msg tea.Msg) (ConfirmModel, tea.Cmd)
Update handles messages for the confirmation model.
func (ConfirmModel) View
func (m ConfirmModel) View() string
View renders the confirmation prompt.
ConfirmOption configures a ConfirmModel.
type ConfirmOption func(*ConfirmModel)
func WithConfirmPrompt(prompt string) ConfirmOption
WithConfirmPrompt sets the confirmation prompt text.
func WithConfirmStyles(styles Styles) ConfirmOption
WithConfirmStyles sets custom styles for the confirmation.
func WithDefaultNo() ConfirmOption
WithDefaultNo sets the default selection to No.
func WithDefaultYes() ConfirmOption
WithDefaultYes sets the default selection to Yes.
func WithShowButtons() ConfirmOption
WithShowButtons enables button-style display.
ConfirmProgram wraps a ConfirmModel in a tea.Program for standalone use.
type ConfirmProgram struct {
// contains filtered or unexported fields
}
func NewConfirmProgram(opts ...ConfirmOption) *ConfirmProgram
NewConfirmProgram creates a new confirmation program for standalone operation.
func (*ConfirmProgram) Run
func (cp *ConfirmProgram) Run() (confirmed bool, cancelled bool, err error)
Run runs the confirmation program and returns the result.
ConfirmResultMsg is sent when the confirmation is resolved.
type ConfirmResultMsg struct {
Confirmed bool
Cancelled bool
}
Editor provides functionality to open an external editor.
type Editor struct {
// contains filtered or unexported fields
}
func NewEditor(config EditorConfig) (*Editor, error)
NewEditor creates a new Editor instance.
func (*Editor) Edit
func (e *Editor) Edit() (string, error)
Edit opens the editor with the initial content and returns the edited content.
func (e *Editor) FilePath() string
FilePath returns the path of the temp file (useful if DeleteOnClose is false).
EditorConfig configures the editor behavior.
type EditorConfig struct {
// Extension is the file extension for the temp file (default: ".md")
Extension string
// InitialContent is the initial content to show in the editor
InitialContent string
// Prefix is a prefix for the temp file name
Prefix string
// AllowEmpty if true, allows empty content to be returned
AllowEmpty bool
// DeleteOnClose if true, deletes the temp file after editing
DeleteOnClose bool
}
func DefaultEditorConfig() EditorConfig
DefaultEditorConfig returns the default editor configuration.
InputCancelMsg is sent when the input is cancelled.
type InputCancelMsg struct{}
InputModel represents a styled text input with validation support.
type InputModel struct {
// contains filtered or unexported fields
}
func NewInput(opts ...InputOption) InputModel
NewInput creates a new InputModel.
func (m *InputModel) Blur()
Blur removes focus from the input.
func (m InputModel) Cancelled() bool
Cancelled returns whether the input was cancelled.
func (m InputModel) Error() error
Error returns any validation error.
func (m *InputModel) Focus() tea.Cmd
Focus focuses the input.
func (m InputModel) Init() tea.Cmd
Init initializes the input model.
func (m *InputModel) Reset()
Reset resets the input state.
func (m *InputModel) SetValue(value string)
SetValue sets the input value.
func (m InputModel) Submitted() bool
Submitted returns whether the input was submitted.
func (m InputModel) Update(msg tea.Msg) (InputModel, tea.Cmd)
Update handles messages for the input model.
func (m InputModel) Value() string
Value returns the current input value.
func (m InputModel) View() string
View renders the input.
InputOption configures an InputModel.
type InputOption func(*InputModel)
func WithCharLimit(limit int) InputOption
WithCharLimit sets the character limit.
func WithInitialValue(value string) InputOption
WithInitialValue sets the initial input value.
func WithInputStyles(styles Styles) InputOption
WithInputStyles sets custom styles for the input.
func WithMasked() InputOption
WithMasked enables password masking mode.
func WithPlaceholder(placeholder string) InputOption
WithPlaceholder sets the placeholder text.
func WithPrompt(prompt string) InputOption
WithPrompt sets the input prompt text.
func WithValidation(fn ValidationFunc) InputOption
WithValidation sets the validation function.
func WithWidth(width int) InputOption
WithWidth sets the input width.
InputProgram wraps an InputModel in a tea.Program for standalone use.
type InputProgram struct {
// contains filtered or unexported fields
}
func NewInputProgram(opts ...InputOption) *InputProgram
NewInputProgram creates a new input program for standalone operation.
func (ip *InputProgram) Run() (string, error)
Run runs the input program and returns the entered value.
func (ip *InputProgram) RunWithCancel() (value string, cancelled bool, err error)
RunWithCancel runs the input program and returns the entered value and cancellation status.
InputSubmitMsg is sent when the input is submitted.
type InputSubmitMsg struct {
Value string
}
MultiSelectCancelMsg is sent when the multi-select is cancelled.
type MultiSelectCancelMsg struct{}
MultiSelectModel represents a multi-select picker with fuzzy search filtering.
type MultiSelectModel struct {
// contains filtered or unexported fields
}
func NewMultiSelect(opts ...MultiSelectOption) MultiSelectModel
NewMultiSelect creates a new MultiSelectModel.
func (MultiSelectModel) Cancelled
func (m MultiSelectModel) Cancelled() bool
Cancelled returns whether the selection was cancelled.
func (MultiSelectModel) Init
func (m MultiSelectModel) Init() tea.Cmd
Init initializes the multi-select model.
func (MultiSelectModel) Items
func (m MultiSelectModel) Items() []PickerItem
Items returns all items.
func (m MultiSelectModel) SelectedItems() []PickerItem
SelectedItems returns all selected items.
func (*MultiSelectModel) SetItems
func (m *MultiSelectModel) SetItems(items []PickerItem)
SetItems updates the items and resets the filter.
func (MultiSelectModel) Submitted
func (m MultiSelectModel) Submitted() bool
Submitted returns whether the selection was confirmed.
func (MultiSelectModel) Update
func (m MultiSelectModel) Update(msg tea.Msg) (MultiSelectModel, tea.Cmd)
Update handles messages for the multi-select model.
func (MultiSelectModel) View
func (m MultiSelectModel) View() string
View renders the multi-select.
MultiSelectOption configures a MultiSelectModel.
type MultiSelectOption func(*MultiSelectModel)
func WithMultiSelectHeight(height int) MultiSelectOption
WithMultiSelectHeight sets the maximum visible items.
func WithMultiSelectItems(items []PickerItem) MultiSelectOption
WithMultiSelectItems sets the initial items.
func WithMultiSelectMaximum(max int) MultiSelectOption
WithMultiSelectMaximum sets the maximum allowed selections.
func WithMultiSelectMinimum(min int) MultiSelectOption
WithMultiSelectMinimum sets the minimum required selections.
func WithMultiSelectSearch(enabled bool) MultiSelectOption
WithMultiSelectSearch enables or disables the search input.
func WithMultiSelectStyles(styles Styles) MultiSelectOption
WithMultiSelectStyles sets custom styles.
func WithMultiSelectTitle(title string) MultiSelectOption
WithMultiSelectTitle sets the title.
func WithPreselected(ids []string) MultiSelectOption
WithPreselected marks specific items as selected by their IDs.
MultiSelectProgram wraps a MultiSelectModel in a tea.Program for standalone use.
type MultiSelectProgram struct {
// contains filtered or unexported fields
}
func NewMultiSelectProgram(opts ...MultiSelectOption) *MultiSelectProgram
NewMultiSelectProgram creates a new multi-select program for standalone operation.
func (*MultiSelectProgram) Run
func (mp *MultiSelectProgram) Run() ([]PickerItem, error)
Run runs the multi-select program and returns the selected items.
MultiSelectResultMsg is sent when the multi-select is confirmed.
type MultiSelectResultMsg struct {
Items []PickerItem
}
PickerCancelMsg is sent when the picker is cancelled.
type PickerCancelMsg struct{}
PickerItem represents an item in the picker.
type PickerItem struct {
ID string // Unique identifier
Label string // Display text
Detail string // Additional detail (displayed after label)
Icon string // Optional icon prefix
Selected bool // For multi-select mode
Value any // Optional associated value
}
PickerModel represents a list picker with fuzzy search filtering.
type PickerModel struct {
// contains filtered or unexported fields
}
func NewPicker(opts ...PickerOption) PickerModel
NewPicker creates a new PickerModel.
func (PickerModel) Cancelled
func (m PickerModel) Cancelled() bool
Cancelled returns whether the picker was cancelled.
func (PickerModel) Init
func (m PickerModel) Init() tea.Cmd
Init initializes the picker model.
func (PickerModel) Items
func (m PickerModel) Items() []PickerItem
Items returns all items.
func (m PickerModel) SelectedItem() *PickerItem
SelectedItem returns the currently highlighted item, or nil if none.
func (*PickerModel) SetItems
func (m *PickerModel) SetItems(items []PickerItem)
SetItems updates the items and resets the filter.
func (PickerModel) Submitted
func (m PickerModel) Submitted() bool
Submitted returns whether an item was selected.
func (PickerModel) Update
func (m PickerModel) Update(msg tea.Msg) (PickerModel, tea.Cmd)
Update handles messages for the picker model.
func (PickerModel) View
func (m PickerModel) View() string
View renders the picker.
PickerOption configures a PickerModel.
type PickerOption func(*PickerModel)
func WithPickerHeight(height int) PickerOption
WithPickerHeight sets the maximum visible items.
func WithPickerItems(items []PickerItem) PickerOption
WithPickerItems sets the initial items.
func WithPickerSearch(enabled bool) PickerOption
WithPickerSearch enables or disables the search input.
func WithPickerStyles(styles Styles) PickerOption
WithPickerStyles sets custom styles.
func WithPickerTitle(title string) PickerOption
WithPickerTitle sets the picker title.
PickerProgram wraps a PickerModel in a tea.Program for standalone use.
type PickerProgram struct {
// contains filtered or unexported fields
}
func NewPickerProgram(opts ...PickerOption) *PickerProgram
NewPickerProgram creates a new picker program for standalone operation.
func (*PickerProgram) Run
func (pp *PickerProgram) Run() (*PickerItem, error)
Run runs the picker program and returns the selected item.
PickerSelectMsg is sent when an item is selected.
type PickerSelectMsg struct {
Item PickerItem
}
SpinnerCompleteStepMsg marks the current step as completed.
type SpinnerCompleteStepMsg struct {
Error error
}
SpinnerDoneMsg signals that the spinner should stop.
type SpinnerDoneMsg struct {
Error error
}
SpinnerModel represents a progress spinner with optional multi-step display.
type SpinnerModel struct {
// contains filtered or unexported fields
}
func NewSpinner(opts ...SpinnerOption) SpinnerModel
NewSpinner creates a new SpinnerModel.
func (*SpinnerModel) AddStep
func (m *SpinnerModel) AddStep(msg string)
AddStep adds a new step to the multi-step progress display.
func (m *SpinnerModel) CompleteStep(err error)
CompleteStep marks the current step as completed.
func (SpinnerModel) Done
func (m SpinnerModel) Done() bool
Done returns whether the spinner has completed.
func (SpinnerModel) Error
func (m SpinnerModel) Error() error
Error returns any error that occurred.
func (*SpinnerModel) Finish
func (m *SpinnerModel) Finish(err error)
Finish marks the spinner as done.
func (SpinnerModel) Init
func (m SpinnerModel) Init() tea.Cmd
Init initializes the spinner model.
func (*SpinnerModel) SetMessage
func (m *SpinnerModel) SetMessage(msg string)
SetMessage sets the current message.
func (SpinnerModel) Update
func (m SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)
Update handles messages for the spinner model.
func (SpinnerModel) View
func (m SpinnerModel) View() string
View renders the spinner.
SpinnerOption configures a SpinnerModel.
type SpinnerOption func(*SpinnerModel)
func WithMessage(msg string) SpinnerOption
WithMessage sets the initial message.
func WithSpinnerStyle(s spinner.Spinner) SpinnerOption
WithSpinnerStyle sets the spinner animation style.
func WithStyles(styles Styles) SpinnerOption
WithStyles sets custom styles for the spinner.
SpinnerProgram wraps a SpinnerModel in a tea.Program for standalone use.
type SpinnerProgram struct {
// contains filtered or unexported fields
}
func NewSpinnerProgram(opts ...SpinnerOption) *SpinnerProgram
NewSpinnerProgram creates a new spinner program for standalone operation.
func (*SpinnerProgram) AddStep
func (sp *SpinnerProgram) AddStep(msg string)
AddStep adds a new step to the spinner.
func (sp *SpinnerProgram) CompleteStep(err error)
CompleteStep completes the current step.
func (*SpinnerProgram) Done
func (sp *SpinnerProgram) Done(err error)
Done signals completion and stops the spinner.
func (*SpinnerProgram) Start
func (sp *SpinnerProgram) Start() error
Start starts the spinner program in the background.
func (sp *SpinnerProgram) UpdateMessage(msg string)
UpdateMessage sends a message update to the spinner.
func (*SpinnerProgram) Wait
func (sp *SpinnerProgram) Wait() error
Wait blocks until the program exits.
SpinnerStep represents a single step in a multi-step progress display.
type SpinnerStep struct {
Message string
Completed bool
Error error
}
SpinnerStepMsg adds a new step to the spinner.
type SpinnerStepMsg struct {
Message string
}
SpinnerUpdateMsg updates the spinner message.
type SpinnerUpdateMsg string
Styles provides a collection of reusable Lipgloss styles.
type Styles struct {
// Base styles
Base lipgloss.Style
// Title and header styles
Title lipgloss.Style
Subtitle lipgloss.Style
Header lipgloss.Style
// Content styles
Normal lipgloss.Style
Bold lipgloss.Style
Muted lipgloss.Style
Highlight lipgloss.Style
// Status styles
Success lipgloss.Style
Warning lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
// List/Picker styles
ListItem lipgloss.Style
ListItemSelected lipgloss.Style
ListCursor lipgloss.Style
// Input styles
InputPrompt lipgloss.Style
InputText lipgloss.Style
InputPlaceholder lipgloss.Style
// Border styles
BorderedBox lipgloss.Style
// Spinner styles
Spinner lipgloss.Style
// Button styles
ButtonActive lipgloss.Style
ButtonInactive lipgloss.Style
// Checkbox styles
CheckboxChecked lipgloss.Style
CheckboxUnchecked lipgloss.Style
// Help styles
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
// contains filtered or unexported fields
}
func DefaultStyles() Styles
DefaultStyles returns a new Styles instance with the default color scheme.
func NewStyles(scheme ColorScheme) Styles
NewStyles creates a new Styles instance with the given color scheme.
func (Styles) Scheme
func (s Styles) Scheme() ColorScheme
Scheme returns the color scheme used by these styles.
ValidationFunc is a function that validates input and returns an error message if invalid.
type ValidationFunc func(value string) error
Generated by gomarkdoc