Documentation
¶
Index ¶
- Constants
- Variables
- func Banner() string
- func Centered(width int, content string) string
- func ContentWidth(termWidth int) int
- func KeyBind(key, label string) string
- func KeyValue(key, value string) string
- func MaskEmail(email string) string
- func RunConfirm(message, expected string) (bool, error)
- func RunProgress(title string, steps []string, run func(p *ProgressRunner)) error
- func RunWizard(title string, fields []WizardField) ([]string, bool, error)
- func StatusIcon(ok bool) string
- func StatusText(status string) string
- func Step(msg string) string
- func StepResult(icon, msg string) string
- type ConfirmModel
- type ProgressDoneMsg
- type ProgressModel
- type ProgressRunner
- func (r *ProgressRunner) Done(index int, detail string)
- func (r *ProgressRunner) Fail(index int, detail string)
- func (r *ProgressRunner) Print(s string)
- func (r *ProgressRunner) Start(index int)
- func (r *ProgressRunner) SubRow(index int, row string)
- func (r *ProgressRunner) Warn(index int, detail string)
- type StepAddSubRowMsg
- type StepFunc
- type StepItem
- type StepStatus
- type StepUpdateMsg
- type WizardField
- type WizardModel
Constants ¶
View Source
const MaxWidth = 90
Variables ¶
View Source
var ( ColorAccent = lipgloss.Color("#fab283") // warm peach/orange — primary accent ColorGreen = lipgloss.Color("#7fd88f") ColorRed = lipgloss.Color("#e06c75") ColorYellow = lipgloss.Color("#f5a742") ColorBlue = lipgloss.Color("#56b6c2") ColorPurple = lipgloss.Color("#9d7cd8") ColorDim = lipgloss.Color("#555555") ColorMuted = lipgloss.Color("#808080") ColorWhite = lipgloss.Color("#eeeeee") ColorBorder = lipgloss.Color("#2a2a2a") ColorPanel = lipgloss.Color("#141414") ColorBg = lipgloss.Color("#0a0a0a") )
View Source
var ( IconSuccess = lipgloss.NewStyle().Foreground(ColorGreen).Render("•") IconError = lipgloss.NewStyle().Foreground(ColorRed).Render("•") IconWarn = lipgloss.NewStyle().Foreground(ColorYellow).Render("△") IconPending = lipgloss.NewStyle().Foreground(ColorBlue).Render("○") IconArrow = lipgloss.NewStyle().Foreground(ColorAccent).Render("→") IconDot = lipgloss.NewStyle().Foreground(ColorDim).Render("·") )
View Source
var ( Bold = lipgloss.NewStyle().Bold(true) Dim = lipgloss.NewStyle().Foreground(ColorDim) Muted = lipgloss.NewStyle().Foreground(ColorMuted) Subtle = lipgloss.NewStyle().Foreground(ColorDim).Italic(true) Highlight = lipgloss.NewStyle().Foreground(ColorAccent).Bold(true) Success = lipgloss.NewStyle().Foreground(ColorGreen) Error = lipgloss.NewStyle().Foreground(ColorRed) Warn = lipgloss.NewStyle().Foreground(ColorYellow) Info = lipgloss.NewStyle().Foreground(ColorBlue) White = lipgloss.NewStyle().Foreground(ColorWhite) Accent = lipgloss.NewStyle().Foreground(ColorAccent) )
View Source
var ( SectionTitle = lipgloss.NewStyle(). Foreground(ColorMuted). Bold(true). MarginTop(1) StepStyle = lipgloss.NewStyle(). Foreground(ColorAccent). Bold(true) )
View Source
var ( Panel = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(1, 2) SuccessPanel = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorGreen). Padding(1, 2) ErrorPanel = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorRed). Padding(1, 2) WarnPanel = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorYellow). Padding(1, 2) InfoPanel = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(1, 2) )
View Source
var ( TableHeader = lipgloss.NewStyle(). Foreground(ColorMuted). Bold(true). PaddingRight(2) TableCell = lipgloss.NewStyle(). PaddingRight(2) TableCellDim = lipgloss.NewStyle(). Foreground(ColorDim). PaddingRight(2) )
Functions ¶
func ContentWidth ¶
func MaskEmail ¶
MaskEmail replaces the local part of an email with stars for display. e.g. "user@gmail.com" -> "u***@gmail.com"
func RunConfirm ¶
RunConfirm shows a danger confirmation prompt and returns whether the user confirmed.
func RunProgress ¶
func RunProgress(title string, steps []string, run func(p *ProgressRunner)) error
func RunWizard ¶
func RunWizard(title string, fields []WizardField) ([]string, bool, error)
RunWizard runs a wizard and returns the values.
func StatusIcon ¶
func StatusText ¶
func StepResult ¶
Types ¶
type ConfirmModel ¶
type ConfirmModel struct {
// contains filtered or unexported fields
}
func NewConfirm ¶
func NewConfirm(message, expected string) ConfirmModel
func (ConfirmModel) Confirmed ¶
func (m ConfirmModel) Confirmed() bool
func (ConfirmModel) Init ¶
func (m ConfirmModel) Init() tea.Cmd
func (ConfirmModel) View ¶
func (m ConfirmModel) View() string
type ProgressDoneMsg ¶
type ProgressDoneMsg struct{}
type ProgressModel ¶
type ProgressModel struct {
Steps []StepItem
// contains filtered or unexported fields
}
func NewProgressModel ¶
func NewProgressModel(title string) ProgressModel
func (ProgressModel) Init ¶
func (m ProgressModel) Init() tea.Cmd
func (ProgressModel) View ¶
func (m ProgressModel) View() string
type ProgressRunner ¶
func (*ProgressRunner) Done ¶
func (r *ProgressRunner) Done(index int, detail string)
func (*ProgressRunner) Fail ¶
func (r *ProgressRunner) Fail(index int, detail string)
func (*ProgressRunner) Print ¶
func (r *ProgressRunner) Print(s string)
func (*ProgressRunner) Start ¶
func (r *ProgressRunner) Start(index int)
func (*ProgressRunner) SubRow ¶
func (r *ProgressRunner) SubRow(index int, row string)
func (*ProgressRunner) Warn ¶
func (r *ProgressRunner) Warn(index int, detail string)
type StepAddSubRowMsg ¶
type StepItem ¶
type StepItem struct {
Label string
Status StepStatus
Detail string
SubRows []string
}
type StepStatus ¶
type StepStatus int
const ( StepPending StepStatus = iota StepRunning StepDone StepWarn StepFail )
type StepUpdateMsg ¶
type StepUpdateMsg struct {
Index int
Status StepStatus
Detail string
}
type WizardField ¶
type WizardModel ¶
type WizardModel struct {
// contains filtered or unexported fields
}
func NewWizard ¶
func NewWizard(title string, fields []WizardField) WizardModel
func (WizardModel) Completed ¶
func (m WizardModel) Completed() bool
func (WizardModel) Init ¶
func (m WizardModel) Init() tea.Cmd
func (WizardModel) Values ¶
func (m WizardModel) Values() []string
func (WizardModel) View ¶
func (m WizardModel) View() string
Click to show internal directories.
Click to hide internal directories.