Documentation
¶
Overview ¶
Package ui provides UI components for interactive flows
Package ui provides UI components for interactive flows
Index ¶
- Constants
- func CollectWithForm(form *huh.Form, errorMsg string) error
- func CreateConfirmForm(title, description, affirmative, negative string, value *bool) *huh.Form
- func CreateConfirmGroup(title, description, affirmative, negative string, value *bool) *huh.Group
- func CreateInputForm(title, placeholder, description string, validator func(string) error, ...) *huh.Form
- func CreateInputGroup(title, placeholder, description string, validator func(string) error, ...) *huh.Group
- func CreateMultiSelectForm(title, description string, options []huh.Option[string], value *[]string) *huh.Form
- func CreateNoteForm(title, description string) *huh.Form
- func CreateNoteGroup(title, description string) *huh.Group
- func CreateSelectForm(title, description string, options []huh.Option[string], value *string) *huh.Form
- func CreateSelectGroup(title, description string, options []huh.Option[string], value *string) *huh.Group
- func GetEnvironmentStyle(environment string) lipgloss.Style
- func GetStatusStyle(status string) lipgloss.Style
- func IsTerminal() bool
- type Column
- type ProgressTracker
- type Row
- type Table
- func (t *Table) Print()
- func (t *Table) Render() string
- func (t *Table) SetColumns(columns []Column) *Table
- func (t *Table) SetHeaderStyle(style lipgloss.Style) *Table
- func (t *Table) SetMaxWidth(width int) *Table
- func (t *Table) SetRows(rows []Row) *Table
- func (t *Table) SetSeparatorStyle(style lipgloss.Style) *Table
Constants ¶
const ( // ProgressStepCount is the default number of steps in progress tracking ProgressStepCount = 4 // TableMaxWidth is the maximum width for table displays TableMaxWidth = 120 // SpinnerRefreshRate is how often to refresh spinner animations SpinnerRefreshRate = 100 * time.Millisecond )
UI and Display
const ( ColorBrightCyan = "14" ColorRed = "9" ColorYellow = "11" ColorGreen = "10" ColorGray = "7" ColorBrightGray = "8" ColorBrightWhite = "15" )
Color constants for consistent styling
Variables ¶
This section is empty.
Functions ¶
func CollectWithForm ¶
CollectWithForm is a generic form collection helper to reduce code duplication
func CreateConfirmForm ¶
CreateConfirmForm creates a confirm form
func CreateConfirmGroup ¶
CreateConfirmGroup creates a confirm group for a form
func CreateInputForm ¶
func CreateInputForm(title, placeholder, description string, validator func(string) error, value *string) *huh.Form
CreateInputForm creates an input form
func CreateInputGroup ¶
func CreateInputGroup(title, placeholder, description string, validator func(string) error, value *string) *huh.Group
CreateInputGroup creates an input group for a form
func CreateMultiSelectForm ¶
func CreateMultiSelectForm(title, description string, options []huh.Option[string], value *[]string) *huh.Form
CreateMultiSelectForm creates a multi-select form
func CreateNoteForm ¶
CreateNoteForm creates a note form
func CreateNoteGroup ¶
CreateNoteGroup creates a note group for a form
func CreateSelectForm ¶
func CreateSelectForm(title, description string, options []huh.Option[string], value *string) *huh.Form
CreateSelectForm creates a select form
func CreateSelectGroup ¶
func CreateSelectGroup(title, description string, options []huh.Option[string], value *string) *huh.Group
CreateSelectGroup creates a select group for a form
func GetEnvironmentStyle ¶
Common style functions for reuse
func GetStatusStyle ¶
Types ¶
type Column ¶
type Column struct { Title string Key string Width int MinWidth int MaxWidth int Truncate bool StyleFunc func(value string) lipgloss.Style Condition bool }
Column represents a table column definition
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker helps track steps during interactive flows
func NewProgressTracker ¶
func NewProgressTracker() *ProgressTracker
NewProgressTracker creates a new progress tracker with the default steps
func (*ProgressTracker) GetCurrentStep ¶
func (pt *ProgressTracker) GetCurrentStep() string
GetCurrentStep returns the current step
func (*ProgressTracker) NextStep ¶
func (pt *ProgressTracker) NextStep()
NextStep increments the current step
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a configurable table renderer
func (*Table) SetColumns ¶
SetColumns sets the table columns
func (*Table) SetHeaderStyle ¶
SetHeaderStyle sets the header styling
func (*Table) SetMaxWidth ¶
SetMaxWidth sets the maximum table width