Documentation
¶
Index ¶
- Constants
- Variables
- func AppendTail(lines []string, keep int, more ...string) []string
- func Checkbox(checked, focused bool, label string) string
- func ConfirmButtons(yesLabel, noLabel string, yesActive bool) string
- func ConfirmNav(confirmYes bool, key string) bool
- func DividerLine() string
- func DrainCmdOutput(cmd *exec.Cmd, ch chan<- string, useStdout bool) ([]string, error)
- func FailLine(msg string) string
- func FilterMultiSelect(ctx context.Context, title, help string, items []FilterMultiSelectItem) ([]string, error)
- func FilterSelect(ctx context.Context, title, help string, items []FilterSelectItem) (string, error)
- func FormatLabel(label, detail string) string
- func FormatLabelDim(label, detail string) string
- func Hyperlink(url, label string) string
- func JoinColumns(left, right string, gap int) string
- func KVRow(key, value string) string
- func KeyString(msg tea.KeyPressMsg) string
- func MascotCowsay(targetWidth int, text string) string
- func MascotStandard(targetWidth int) string
- func MoveCursor(cursor int, key string, count int) int
- func NewBrandSpinner() spinner.Model
- func NewUpdateCheckCmd(wait func(context.Context) bool) tea.Cmd
- func NewYesNo() *huh.Select[string]
- func PadRight(s string, width int) string
- func PanelWidth() int
- func PhaseFooter(hint, exitLabel string) string
- func PrintBanner()
- func PrintTable(headers []string, rows [][]string)
- func ReadLineCmd(ch <-chan string, onLine func(string) tea.Msg, onDone tea.Msg) tea.Cmd
- func RenderCancelledMessage() string
- func RenderPanel(title, content string, titleColor color.Color) string
- func RenderPhaseCard(content string) string
- func RenderPhaseCardCowsay(speech, content string) string
- func RenderSelectList(title, description string, options []SelectOption, cursor int) string
- func RenderSelectListWindowed(title, description string, options []SelectOption, cursor, maxVisible int) string
- func RenderStyledLink(url string) string
- func RenderSuccessPanel(content string) string
- func RenderTable(headers []string, rows [][]string) string
- func RunSpinnerWithLogs(ctx context.Context, title string, cmd *exec.Cmd) error
- func SectionDivider(width int) string
- func ShopwareTheme() huh.Theme
- func ShortcutBadge(key, label string) string
- func ShortcutBar(shortcuts ...Shortcut) string
- func ShortcutBarFit(maxWidth int, shortcuts ...Shortcut) string
- func SpreadRow(width int, left, right string) string
- func StateDot(s DotState) string
- func StatusBadge(status string, c color.Color) string
- func StreamCmdOutput(cmd *exec.Cmd, ch chan<- string, useStdout bool) error
- func StyledLink(url, label string, style lipgloss.Style) string
- func SuccessLine(msg string) string
- func TailLines(lines []string, n int) []string
- func TailWrappedLines(lines []string, maxRows, width int) []string
- func TerminalWidth() int
- func TextBadge(text string) string
- func Truncate(s string, width int) string
- func VariantColor(v Variant) color.Color
- type ButtonRow
- type ButtonRowOptions
- type CheckRow
- type CheckRowOptions
- type CredFocus
- type CredentialStep
- func (c *CredentialStep) Blur()
- func (c *CredentialStep) Focus(target CredFocus) tea.Cmd
- func (c CredentialStep) FocusTarget() CredFocus
- func (c CredentialStep) FooterHint(submitLabel string) string
- func (c *CredentialStep) HandleKey(msg tea.KeyPressMsg) (cmd tea.Cmd, submitted bool)
- func (c *CredentialStep) HandlePaste(msg tea.PasteMsg) tea.Cmd
- func (c CredentialStep) Password() string
- func (c CredentialStep) PasswordErr() string
- func (c CredentialStep) PasswordMasked() bool
- func (c CredentialStep) Render(b *strings.Builder)
- func (c *CredentialStep) SetPassword(v string)
- func (c *CredentialStep) SetUsername(v string)
- func (c *CredentialStep) ToggleShowPassword()
- func (c CredentialStep) Username() string
- func (c *CredentialStep) ValidatePassword() bool
- type CredentialStepOptions
- type DotState
- type FilterItem
- type FilterList
- type FilterListOptions
- type FilterMultiSelectItem
- type FilterSelectItem
- type Header
- type LineWriter
- type Modal
- type ModalOptions
- type Scrollbar
- type ScrollbarOptions
- type SelectList
- type SelectOption
- type Shortcut
- type Shortcuts
- type ShortcutsOptions
- type StatusStrip
- type StatusStripOptions
- type StepItem
- type StepList
- type StepListOptions
- type StepState
- type Table
- type TableCell
- type TableColumn
- type TableFormat
- type Task
- type TaskDoneMsg
- type TaskLineMsg
- type TwoColumn
- type TwoColumnOptions
- type UpdateAvailableMsg
- type Variant
- type WizardFrame
- type WizardFrameOptions
Constants ¶
const ( Yes = "yes" No = "no" )
const ( KeyCtrlC = "ctrl+c" KeyEnter = "enter" KeyEsc = "esc" KeyUp = "up" KeyDown = "down" KeyLeft = "left" KeyRight = "right" KeyTab = "tab" KeyShiftTab = "shift+tab" )
String forms of the special keys as produced by KeyString. Printable keys ("q", "j", "1", …) are matched with plain literals instead.
const KVKeyWidth = 22
KVKeyWidth is the column width of the key in KVRow. Callers laying out multi-line values indent their continuation lines by it plus KVRowIndent.
const KVRowIndent = 2
KVRowIndent is the left indentation KVRow puts in front of the key.
const PhaseCardWidth = 79
const StreamBufferSize = 50
StreamBufferSize is the channel buffer used for streaming subprocess output lines into a Bubble Tea program.
Variables ¶
var ( // LabelStyle renders text in the primary text color. LabelStyle = lipgloss.NewStyle().Foreground(TextColor) // LinkStyle renders clickable hyperlinks in a muted blue with an underline. LinkStyle = lipgloss.NewStyle().Foreground(LinkColor).Underline(true) // TitleStyle renders section headings in bold with the primary text color. TitleStyle = lipgloss.NewStyle().Bold(true).Foreground(TextColor) )
var ( CheckOK = GreenText.Render("✓") CheckWarn = SecondaryText.Render("⚠") CheckFail = RedText.Render("✗") )
Status glyphs for composing command output lines, e.g. fmt.Printf("%s Project config: %s\n", tui.CheckOK, value).
var ( // BrandColor is the Shopware brand blue used for focus, selection // markers, and primary buttons. BrandColor = lipgloss.Color("#076FFF") SuccessColor = lipgloss.Color("#04B575") MutedColor = adaptiveMuted() ErrorColor = lipgloss.Color("#FF4D4D") // TextColor is the primary foreground for labels, headings, and prominent content. TextColor = adaptiveColor("#FFFFFF", "#1A1A1A") // OnBrandColor is the foreground for text placed on top of BrandColor. // BrandColor is a fixed blue regardless of terminal theme, so this stays // light in both modes to keep contrast readable. OnBrandColor = lipgloss.Color("#FFFDF5") // BorderColor is used for box borders, dividers, and separator lines. BorderColor = adaptiveColor("#303030", "#BCBCBC") // SubtleBgColor is used for inactive tab backgrounds, badges, and other subtle background fills. SubtleBgColor = adaptiveColor("#444444", "#D0D0D0") // LinkColor is used for clickable hyperlinks. LinkColor = adaptiveColor("#5F87FF", "#0550AE") // WarnColor is used for warning-level indicators. WarnColor = adaptiveColor("#FFAA00", "#B35800") // SelectedBgColor is used for highlighted/selected rows in lists and tables. SelectedBgColor = adaptiveColor("#303030", "#E4E4E4") Checkmark = lipgloss.NewStyle().Foreground(SuccessColor).Bold(true).Render("✓") DimStyle = lipgloss.NewStyle().Foreground(MutedColor) BoldStyle = lipgloss.NewStyle().Bold(true) SectionTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(BrandColor) )
Semantic colors used across shopware-cli TUI components, adapted to the terminal's light or dark background at startup.
var ActiveButtonStyle = lipgloss.NewStyle(). Foreground(OnBrandColor). Background(BrandColor). Bold(true). Padding(0, 2)
ActiveButtonStyle renders a focused/primary button.
var AppVersion = "dev"
AppVersion is the CLI version displayed in headers and branding lines. It is set from cmd/root.go at startup.
var BlueColor = compat.AdaptiveColor{ Light: lipgloss.Color("#0063B8"), Dark: lipgloss.Color("#189EFF"), }
var BlueText = lipgloss.NewStyle().Foreground(BlueColor)
var BoldText = lipgloss.NewStyle().Bold(true)
var DimText = lipgloss.NewStyle().Faint(true)
var ErrFilterSelectCancelled = errors.New("selection cancelled")
ErrFilterSelectCancelled is returned by FilterSelect when the user dismisses the prompt with Esc or Ctrl+C.
var GreenText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#047857"), Dark: lipgloss.Color("#04B575"), })
var NeutralText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#1F2937"), Dark: lipgloss.Color("#FFFFFF"), })
var RecommendedText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#047857"), Dark: lipgloss.Color("#04B575"), }).Bold(true)
var RedText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#DC2626"), Dark: lipgloss.Color("#EF4444"), })
var SecondaryText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#B8860B"), Dark: lipgloss.Color("#FFD700"), }).Bold(true)
var SectionHeadingStyle = lipgloss.NewStyle().Bold(true).Underline(true)
SectionHeadingStyle renders bold, underlined section headings in command output ("Project", "Next steps", "Summary", …).
var UpdateAvailable func(context.Context) bool
UpdateAvailable blocks until the background update check finishes and reports whether a newer, installable release exists. It is set from cmd/root.go at startup, like AppVersion; when nil, the header skips the update hint entirely.
var YellowText = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{ Light: lipgloss.Color("#B8860B"), Dark: lipgloss.Color("#FFD700"), })
Functions ¶
func AppendTail ¶
AppendTail appends more to lines, dropping the oldest entries once the buffer exceeds keep — the shared scrollback shape of streamed command output. keep <= 0 keeps everything.
func Checkbox ¶
Checkbox renders a "[x]"/"[ ]" toggle with its label — muted by default, brand-highlighted when focused.
func ConfirmButtons ¶
ConfirmButtons renders a yes/no button pair with the active side highlighted.
func ConfirmNav ¶
ConfirmNav applies the shared yes/no confirm-row navigation: left (or h) picks yes, right (or l) picks no, tab toggles. Other keys leave the selection unchanged.
func DividerLine ¶
func DividerLine() string
DividerLine renders a horizontal rule spanning most of the terminal width.
func DrainCmdOutput ¶
DrainCmdOutput streams cmd into ch without closing the channel, so callers can run several processes as one captured stream.
func FilterMultiSelect ¶
func FilterMultiSelect(ctx context.Context, title, help string, items []FilterMultiSelectItem) ([]string, error)
FilterMultiSelect renders an interactive picker with a type-to-filter input and a windowed list that allows toggling multiple items. It returns the chosen Values in the original item order, or ErrFilterSelectCancelled if the user dismisses the prompt.
Use it from CLI commands that need to pick several entries from a list that may be small or huge. For single selection use FilterSelect instead.
func FilterSelect ¶
func FilterSelect(ctx context.Context, title, help string, items []FilterSelectItem) (string, error)
FilterSelect renders an interactive picker with a type-to-filter input and a windowed list. It returns the chosen Value, or ErrFilterSelectCancelled if the user dismisses the prompt.
Use it from CLI commands that need to pick from a list that may be small or huge. Inside a hosted TUI, embed FilterList instead — this helper owns its own bubbletea program.
func FormatLabel ¶
FormatLabel renders a "Label (Detail)" string where the label uses the primary text color and the detail is dimmed in parentheses.
func FormatLabelDim ¶
FormatLabelDim renders a "Label (Detail)" string entirely in dimmed style.
func JoinColumns ¶
JoinColumns glues two multi-line strings side by side with a gap, top-aligned; the left block is padded to its widest line.
func KeyString ¶
func KeyString(msg tea.KeyPressMsg) string
KeyString returns the string form of a key press, lower-cased. With Caps Lock on, the terminal sends the shortcut's shifted form instead of the plain one - e.g. pressing ctrl+c sends "ctrl+C" and ctrl+p sends "ctrl+P" - which doesn't match lowercase key constants ("ctrl+c", "ctrl+p", ...), so the shortcut silently does nothing. Lower-casing here makes the match work either way.
func MascotCowsay ¶
MascotCowsay renders the Shopware mascot with a speech bubble above it containing the given text. The bubble is centered above the mascot and sized to fit text (wrapping long lines to targetWidth-4).
func MascotStandard ¶
MascotStandard renders the Shopware mascot, horizontally centered within targetWidth columns using dot padding.
func MoveCursor ¶
MoveCursor applies an up/down (or k/j) navigation key to a cursor over a list of length count, clamping to [0, count-1]. Keys other than the four navigation keys leave the cursor unchanged.
func NewBrandSpinner ¶
NewBrandSpinner returns the shared brand-colored dot spinner used by the shopware-cli TUIs.
func NewUpdateCheckCmd ¶
NewUpdateCheckCmd waits for an externally-owned update result and converts it into a message understood by Header.Update.
func NewYesNo ¶
NewYesNo returns a huh Select field with Yes/No options. The value pointer should be initialized to tui.Yes or tui.No to set the default.
func PadRight ¶
PadRight pads s with spaces to the given number of terminal columns. Longer strings are returned with a single trailing space instead of truncating — use Truncate first when a hard column limit is needed.
func PanelWidth ¶
func PanelWidth() int
PanelWidth returns the terminal width capped at maxPanelWidth.
func PhaseFooter ¶
PhaseFooter renders the footer row shared by the project dev phase screens and the upgrade wizard: an optional shortcut hint followed by an exit badge (usually "Exit"; "Cancel" while a job is running).
func PrintBanner ¶
func PrintBanner()
func PrintTable ¶
PrintTable prints a bordered table to stdout — the shared shape of the CLI's list outputs.
func ReadLineCmd ¶
ReadLineCmd returns a tea.Cmd that reads the next line from ch and converts it into a message via onLine, or returns onDone once the channel is closed. Re-issue the command after each received line to keep the stream flowing.
func RenderCancelledMessage ¶
func RenderCancelledMessage() string
RenderCancelledMessage renders a dimmed cancellation notice.
func RenderPanel ¶
RenderPanel renders content inside a full-width bordered box with an optional title.
func RenderPhaseCard ¶
RenderPhaseCard renders content inside a fixed-width card with the Shopware mascot art at the top, a divider, and the content below.
func RenderPhaseCardCowsay ¶
RenderPhaseCardCowsay renders content inside a fixed-width card with the Shopware mascot saying the given text via a speech bubble.
func RenderSelectList ¶
func RenderSelectList(title, description string, options []SelectOption, cursor int) string
RenderSelectList renders a titled option list with a ● selector on the active item. The whole list is rendered; use RenderSelectListWindowed when the option count can grow large.
func RenderSelectListWindowed ¶
func RenderSelectListWindowed(title, description string, options []SelectOption, cursor, maxVisible int) string
RenderSelectListWindowed renders a select list that shows at most maxVisible options at once, scrolling to keep the cursor in view. A maxVisible of 0 (or any value >= len(options)) renders every option. When the list is windowed a "Showing X–Y of N" line is appended so the box height stays fixed regardless of how many options exist.
func RenderStyledLink ¶
RenderStyledLink renders a URL as a clickable terminal hyperlink using LinkStyle.
func RenderSuccessPanel ¶
RenderSuccessPanel renders a panel with a green "Project Created" title.
func RenderTable ¶
RenderTable renders a bordered table with a header row. Cells may be pre-styled; every cell gets one column of horizontal padding.
func RunSpinnerWithLogs ¶
RunSpinnerWithLogs executes the given command while displaying a spinner and allowing the user to toggle logs with Ctrl+L.
func SectionDivider ¶
SectionDivider renders a full-width horizontal line in the border color.
func ShopwareTheme ¶
ShopwareTheme returns a huh form theme styled with the Shopware brand colors.
func ShortcutBadge ¶
ShortcutBadge renders a single keyboard shortcut as a styled badge.
func ShortcutBar ¶
ShortcutBar joins multiple shortcuts into a horizontal bar separated by dividers.
func ShortcutBarFit ¶
ShortcutBarFit renders a shortcut bar that stays on a single row within maxWidth: it falls back to narrower separators when the default bar is too wide and truncates with an ellipsis as a last resort.
func StateDot ¶
StateDot renders the semantic status bullet used in front of checklist and queue rows.
func StatusBadge ¶
StatusBadge renders a status indicator in the form "● STATUS".
func StreamCmdOutput ¶
StreamCmdOutput starts cmd and streams its output line by line into ch, closing the channel when the command finishes. With useStdout true, stderr is merged into stdout; otherwise stdout is merged into stderr. It blocks until the command exits and returns its error.
func StyledLink ¶
StyledLink renders a clickable terminal hyperlink with the given lipgloss style.
func SuccessLine ¶
SuccessLine renders a bold green "✓ message" line.
func TailLines ¶
TailLines returns the last n lines (all of them when n >= len). n <= 0 returns nil.
func TailWrappedLines ¶
TailWrappedLines returns the trailing lines that fit into maxRows once wrapping at width is taken into account. Long command output wraps onto several rows, so tailing by slice element alone overflows a fixed-height panel and clips whatever sits at the end. The last line is always included, even when it alone exceeds maxRows.
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the current terminal width, falling back to maxPanelWidth if it cannot be determined.
func Truncate ¶
Truncate shortens s to at most width terminal columns, appending an ellipsis when it cuts. ANSI sequences and wide runes are handled correctly.
func VariantColor ¶
VariantColor maps a semantic variant to its color.
Types ¶
type ButtonRow ¶
type ButtonRow struct {
// contains filtered or unexported fields
}
ButtonRow is a horizontal row of footer buttons with one highlighted.
func NewButtonRow ¶
func NewButtonRow(opts ButtonRowOptions) ButtonRow
NewButtonRow creates a button row.
type ButtonRowOptions ¶
type ButtonRowOptions struct {
Labels []string
// Active is the highlighted button index; -1 highlights none.
Active int
// MaxWidth wraps buttons onto additional lines when a row would exceed
// it — for narrow containers such as a panel's user-action column.
// <= 0 keeps everything on one row.
MaxWidth int
}
ButtonRowOptions configure a ButtonRow.
type CheckRow ¶
type CheckRow struct {
// contains filtered or unexported fields
}
CheckRow is one line of a checklist: a status dot, a padded label, and a value column, e.g. "● Git working tree clean yes".
type CheckRowOptions ¶
type CheckRowOptions struct {
// State drives the leading status dot.
State DotState
// Label is the check description; Value the short right column ("yes",
// "14", …). Value may be pre-styled by the caller.
Label string
Value string
// LabelWidth aligns the value column across rows.
LabelWidth int
}
CheckRowOptions configure a CheckRow.
type CredFocus ¶
type CredFocus int
CredFocus identifies which element of a credential step (username field, password field, or the show-password checkbox) currently has focus.
type CredentialStep ¶
type CredentialStep struct {
// contains filtered or unexported fields
}
CredentialStep is a username/password/show-password fieldset for wizard steps. Embed it in a wizard and route the step's keys through HandleKey; the wizard decides what a submit means.
func NewCredentialStep ¶
func NewCredentialStep(opts CredentialStepOptions) CredentialStep
NewCredentialStep builds the username/password inputs. The password starts masked.
func (*CredentialStep) Blur ¶
func (c *CredentialStep) Blur()
Blur removes focus from both inputs, used when leaving the step.
func (*CredentialStep) Focus ¶
func (c *CredentialStep) Focus(target CredFocus) tea.Cmd
Focus moves focus to the given element, clamping to the valid range and syncing the text input focus. Returns the blink command for the newly focused input (nil for the checkbox).
func (CredentialStep) FocusTarget ¶
func (c CredentialStep) FocusTarget() CredFocus
FocusTarget reports which element currently has focus.
func (CredentialStep) FooterHint ¶
func (c CredentialStep) FooterHint(submitLabel string) string
FooterHint returns the shortcut bar for the step: navigation, the space toggle while the checkbox has focus, and enter for submitLabel on every focus.
func (*CredentialStep) HandleKey ¶
func (c *CredentialStep) HandleKey(msg tea.KeyPressMsg) (cmd tea.Cmd, submitted bool)
HandleKey applies the shared credential-step key handling: tab/down and shift+tab/up move focus, enter advances from the username or submits from the password and the checkbox (after validation), space toggles the checkbox, and any other key types into the focused input. It reports submitted=true when the password passed validation and the step is complete — what a submit means is the embedding wizard's decision.
func (*CredentialStep) HandlePaste ¶
func (c *CredentialStep) HandlePaste(msg tea.PasteMsg) tea.Cmd
HandlePaste routes terminal (bracketed) paste into the focused input. Embedding wizards must call this for tea.PasteMsg — paste does not arrive as key presses, so HandleKey never sees it.
func (CredentialStep) Password ¶
func (c CredentialStep) Password() string
Password returns the current password value.
func (CredentialStep) PasswordErr ¶
func (c CredentialStep) PasswordErr() string
PasswordErr returns the current validation message, empty when valid.
func (CredentialStep) PasswordMasked ¶
func (c CredentialStep) PasswordMasked() bool
PasswordMasked reports whether the password renders masked.
func (CredentialStep) Render ¶
func (c CredentialStep) Render(b *strings.Builder)
Render writes the username/password/show-password block into b. The caller is responsible for the surrounding step heading and footer.
func (*CredentialStep) SetPassword ¶
func (c *CredentialStep) SetPassword(v string)
SetPassword replaces the password value.
func (*CredentialStep) SetUsername ¶
func (c *CredentialStep) SetUsername(v string)
SetUsername replaces the username value.
func (*CredentialStep) ToggleShowPassword ¶
func (c *CredentialStep) ToggleShowPassword()
ToggleShowPassword flips the password between masked and plain text.
func (CredentialStep) Username ¶
func (c CredentialStep) Username() string
Username returns the current username value.
func (*CredentialStep) ValidatePassword ¶
func (c *CredentialStep) ValidatePassword() bool
ValidatePassword runs the configured password check, storing the message in PasswordErr on failure. Returns true when the password is acceptable.
type CredentialStepOptions ¶
type CredentialStepOptions struct {
// Username and Password pre-fill the inputs.
Username string
Password string
// Placeholders shown when the inputs are empty.
UsernamePlaceholder string
PasswordPlaceholder string
// Prompts rendered in front of the inputs (default none).
UsernamePrompt string
PasswordPrompt string
// Labels rendered above the inputs and the optional hint beside the
// password label.
UsernameLabel string
PasswordLabel string
PasswordHint string
// CharLimit bounds both inputs (default 64).
CharLimit int
// ValidatePassword rejects a password on submit; nil accepts anything.
// The error text is rendered under the password field.
ValidatePassword func(password string) error
}
CredentialStepOptions configure NewCredentialStep.
type FilterItem ¶
type FilterItem struct {
// Label is the row text; Detail is dimmed, right-aligned extra text.
// Both are matched by the filter.
Label string
Detail string
// Value is an optional payload identifier for the caller.
Value string
}
FilterItem is one selectable entry of a FilterList.
type FilterList ¶
type FilterList struct {
// contains filtered or unexported fields
}
FilterList is a type-to-filter list with a cursor and a windowed view — the shared mechanics behind pickers and palettes. It handles up/down movement and filter input; enter/esc handling stays with the caller, which reads the choice via Selected.
func NewFilterList ¶
func NewFilterList(opts FilterListOptions) FilterList
NewFilterList creates a filter list.
func (FilterList) Init ¶
func (l FilterList) Init() tea.Cmd
Init returns the cursor blink command for the filter input.
func (FilterList) Items ¶
func (l FilterList) Items() []FilterItem
Items returns all items the list was created with.
func (FilterList) Len ¶
func (l FilterList) Len() int
Len returns the number of items matching the current filter.
func (FilterList) Selected ¶
func (l FilterList) Selected() (FilterItem, int, bool)
Selected returns the item under the cursor and its index in Items.
func (FilterList) Update ¶
func (l FilterList) Update(msg tea.Msg) (FilterList, tea.Cmd)
Update handles cursor movement and filter typing. Enter and esc are not consumed — the caller decides what selection and dismissal mean.
func (FilterList) View ¶
func (l FilterList) View(width int) string
View renders the filter input, the visible window of rows, and a "Showing x of y" line when the list overflows the window.
type FilterListOptions ¶
type FilterListOptions struct {
Items []FilterItem
// PageSize is the number of visible rows (default 10).
PageSize int
// Placeholder for the filter input.
Placeholder string
// InitialIndex preselects an item by its index in Items.
InitialIndex int
// Header is an optional column-header line rendered above the rows.
Header string
}
FilterListOptions configure a FilterList.
type FilterMultiSelectItem ¶
FilterMultiSelectItem is a single row presented by FilterMultiSelect. Label is the primary text, Detail is an optional secondary line (e.g. a path). Both are matched against the filter query. Value is the string returned when the user selects this item.
type FilterSelectItem ¶
FilterSelectItem is a single row presented by FilterSelect. Label is the primary text, Detail is an optional secondary line (e.g. a URL). Both are matched against the filter query. Value is the string returned when the user confirms this item.
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header is the branding header row the dev dashboard, the upgrade wizard, and the plugin-migrate wizard render as shell chrome. It follows the Bubble Tea component shape (Init/Update/View) so message-driven header state can be added here without rewiring the hosts.
func (Header) Init ¶
Init starts the update-hint wait; every host that renders the header gets the hint without extra wiring. Returns nil when no check is configured.
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter converts a byte stream into per-line emit calls — the io.Writer side of streaming subprocess output.
func NewLineWriter ¶
func NewLineWriter(emit func(string)) *LineWriter
NewLineWriter creates a line writer that calls emit for every full line.
func (*LineWriter) Flush ¶
func (w *LineWriter) Flush()
Flush emits any trailing output that did not end in a newline.
type Modal ¶
type Modal struct {
// contains filtered or unexported fields
}
Modal is a bordered box centered within an area — the container used by overlay dialogs (pickers, detail popups, confirmations).
func (Modal) ContentWidth ¶
ContentWidth returns the columns available to content inside the box (border and horizontal padding subtracted). Build content against this width before calling Render.
type ModalOptions ¶
type ModalOptions struct {
// MaxWidth caps the modal box width; the box also never exceeds the area
// width minus a small margin.
MaxWidth int
// AreaWidth and AreaHeight define the region the modal centers within,
// usually the full terminal or the host's main region.
AreaWidth int
AreaHeight int
}
ModalOptions configure a Modal.
type Scrollbar ¶
type Scrollbar struct {
// contains filtered or unexported fields
}
Scrollbar is a vertical scrollbar column: arrows at both ends, a dashed track, and a solid thumb. It renders empty when everything fits.
func NewScrollbar ¶
func NewScrollbar(opts ScrollbarOptions) Scrollbar
NewScrollbar creates a scrollbar.
type ScrollbarOptions ¶
type ScrollbarOptions struct {
// Total is the item count; Visible how many fit; Offset the first shown.
Total int
Visible int
Offset int
// Height is the rendered height in rows (arrows included).
Height int
}
ScrollbarOptions configure a Scrollbar.
type SelectList ¶
type SelectList struct {
// contains filtered or unexported fields
}
SelectList is a stateful, keyboard-navigable single-select list. It owns the cursor and windowing so callers only forward key strings and render. Use it for any fixed-height option picker (e.g. the project upgrade version select).
func NewSelectList ¶
func NewSelectList(title, description string, options []SelectOption, maxVisible int) *SelectList
NewSelectList builds a SelectList. maxVisible caps how many options are shown at once (0 = show all); the window scrolls to keep the cursor visible.
func (*SelectList) Cursor ¶
func (l *SelectList) Cursor() int
Cursor returns the index of the currently highlighted option.
func (*SelectList) HandleKey ¶
func (l *SelectList) HandleKey(key string) bool
HandleKey applies a navigation key (up/down/k/j, pgup/pgdown, home/g, end/G) and reports whether it moved or consumed the cursor. Keys the list does not own (enter, esc, …) return false so the caller can act on them.
func (*SelectList) Selected ¶
func (l *SelectList) Selected() (SelectOption, bool)
Selected returns the currently highlighted option and whether one exists (false when the list is empty).
func (*SelectList) Shortcuts ¶
func (l *SelectList) Shortcuts() []Shortcut
Shortcuts returns the navigation hints to show in a footer. PgUp/PgDn is only included when the list is windowed.
func (*SelectList) View ¶
func (l *SelectList) View() string
View renders the list at its current cursor position.
type SelectOption ¶
SelectOption describes a single option in a select list.
type Shortcuts ¶
type Shortcuts struct {
// contains filtered or unexported fields
}
Shortcuts is a horizontal bar of keyboard shortcut badges.
func NewShortcuts ¶
func NewShortcuts(opts ShortcutsOptions) Shortcuts
NewShortcuts creates a shortcut bar.
type ShortcutsOptions ¶
type ShortcutsOptions struct {
Items []Shortcut
// MaxWidth keeps the bar on a single row within this width: narrower
// separators first, ellipsis truncation as a last resort. <= 0 means
// unconstrained.
MaxWidth int
}
ShortcutsOptions configure a Shortcuts bar.
type StatusStrip ¶
type StatusStrip struct {
// contains filtered or unexported fields
}
StatusStrip is a one-line status row: a bold colored label followed by a plain message, e.g. "BLOCKED 3 extensions need fixes …".
func NewStatusStrip ¶
func NewStatusStrip(opts StatusStripOptions) StatusStrip
NewStatusStrip creates a status strip.
func (StatusStrip) Render ¶
func (s StatusStrip) Render() string
Render implements the component contract.
type StatusStripOptions ¶
type StatusStripOptions struct {
// Variant selects the semantic color of the label.
Variant Variant
// Label is the bold colored badge text, e.g. "BLOCKED" or "READY".
Label string
// Message is the plain explanation after the label.
Message string
}
StatusStripOptions configure a StatusStrip.
type StepItem ¶
type StepItem struct {
Label string
State StepState
// Indicator overrides the state indicator, e.g. a spinner frame for the
// active step.
Indicator string
}
StepItem is one row in a StepList.
type StepList ¶
type StepList struct {
// contains filtered or unexported fields
}
StepList renders a vertical checklist of steps with per-state indicators.
type StepListOptions ¶
type StepListOptions struct {
Steps []StepItem
}
StepListOptions configure a StepList.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table contains one output-neutral table definition.
func NewTable ¶
func NewTable(columns ...TableColumn) *Table
NewTable creates a table with the given columns.
func (*Table) AddRowWithJSON ¶
AddRowWithJSON appends a row with a custom JSON representation. Prefer AddRow when JSON should contain exactly the configured columns. This method supports established JSON contracts that contain more data than the corresponding human-readable table.
type TableCell ¶
TableCell holds a raw value for JSON output and, optionally, a separate representation for terminal output. TerminalText is useful for colors, human-readable booleans, and other presentation that should not leak into machine-readable output.
type TableColumn ¶
TableColumn configures one terminal table column and its corresponding JSON object key.
type TableFormat ¶
type TableFormat string
TableFormat is an output format supported by Table.
const ( TableFormatTable TableFormat = "table" TableFormatJSON TableFormat = "json" )
func ParseTableFormat ¶
func ParseTableFormat(value string) (TableFormat, error)
ParseTableFormat validates a table output format.
type Task ¶
type Task struct {
Title string
// contains filtered or unexported fields
}
Task runs one command in the background and accumulates its streamed output — the shared "run job, show spinner + log tail" machinery behind task screens. Embed it in a model, call Start, and route TaskLineMsg, TaskDoneMsg, and spinner.TickMsg through Update.
func (*Task) Start ¶
Start launches the command produced by factory and begins streaming its combined output. The returned command batch keeps the stream flowing and the spinner ticking; completion arrives as a TaskDoneMsg.
func (Task) StatusTitle ¶
StatusTitle returns the task title, prefixed with the spinner while the command is still running.
type TaskDoneMsg ¶
type TaskDoneMsg struct{ Err error }
TaskDoneMsg is delivered when a task's command has finished and its output has been fully drained.
type TaskLineMsg ¶
type TaskLineMsg struct{ Line string }
TaskLineMsg carries one line of a running task's output.
type TwoColumn ¶
type TwoColumn struct {
// contains filtered or unexported fields
}
TwoColumn renders two blocks side by side separated by a vertical divider, top-aligned and padded to equal height. Wizard panels use it for the read-only left / user-action right split.
func NewTwoColumn ¶
func NewTwoColumn(opts TwoColumnOptions) TwoColumn
NewTwoColumn creates a two-column layout.
type TwoColumnOptions ¶
type TwoColumnOptions struct {
// Width is the total width; LeftWidth the columns left of the divider.
// The divider consumes three columns (" │ ").
Width int
LeftWidth int
Left string
Right string
}
TwoColumnOptions configure a TwoColumn layout.
type UpdateAvailableMsg ¶
type UpdateAvailableMsg struct{}
UpdateAvailableMsg is delivered when the asynchronous update check finds a newer CLI version. Hosts forward it to Header.Update like any other message.
type Variant ¶
type Variant int
Variant is a semantic color role used by feedback components such as StatusStrip.
type WizardFrame ¶
type WizardFrame struct {
// contains filtered or unexported fields
}
WizardFrame is a bordered wizard panel: title row, optional status row, body, and footer, each separated by horizontal rules. It always renders exactly Height rows.
func NewWizardFrame ¶
func NewWizardFrame(opts WizardFrameOptions) WizardFrame
NewWizardFrame creates a wizard frame.
func (WizardFrame) Render ¶
func (f WizardFrame) Render() string
Render implements the component contract.
type WizardFrameOptions ¶
type WizardFrameOptions struct {
Width int
Height int
// Title is the panel title in the frame's top row.
Title string
// TitleRight is an optional right-aligned label, e.g. "Target 6.7.11.0".
TitleRight string
// Status is an optional status row (see StatusStrip) below the title,
// separated by horizontal rules. Multi-line values render as several rows.
Status string
// Body fills the frame's main area, padded or truncated to fit.
Body string
// omits the footer section and lets the body use the full height.
Footer string
}
WizardFrameOptions configure a WizardFrame.
Source Files
¶
- badge.go
- banner.go
- buttonrow.go
- checkbox.go
- checkrow.go
- color.go
- credentialstep.go
- filter_multi_select.go
- filter_select.go
- filterlist.go
- form.go
- header.go
- keys.go
- labels.go
- logtail.go
- mascot.go
- modal.go
- panels.go
- phasecard.go
- phasechrome.go
- printtable.go
- progress_spinner.go
- scrollbar.go
- selectlist.go
- shortcuts.go
- spinner.go
- statedot.go
- statusline.go
- statusstrip.go
- steplist.go
- steps.go
- stream.go
- task.go
- textfit.go
- theme.go
- twocolumn.go
- update.go
- wizardframe.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package app provides a terminal application shell on top of Bubble Tea v2: chrome (header/footer), an overlay stack, keybindings mapped to named commands, and quit handling.
|
Package app provides a terminal application shell on top of Bubble Tea v2: chrome (header/footer), an overlay stack, keybindings mapped to named commands, and quit handling. |
|
Package picker provides a filterable single-select list overlay for the tui/app shell — a type-to-filter input over a windowed list, rendered as a centered modal.
|
Package picker provides a filterable single-select list overlay for the tui/app shell — a type-to-filter input over a windowed list, rendered as a centered modal. |
|
Package pluginmigrate implements the interactive `project autofix composer-plugins` wizard: it scans custom/ for extensions Composer does not manage, classifies them against the Shopware Store packagist, and migrates them (Store requires or path repositories) with rollback on failure.
|
Package pluginmigrate implements the interactive `project autofix composer-plugins` wizard: it scans custom/ for extensions Composer does not manage, classifies them against the Shopware Store packagist, and migrates them (Store requires or path repositories) with rollback on failure. |
|
Package prompt provides a multi-button confirm overlay for the tui/app shell — for questions where a plain yes/no is not enough (e.g.
|
Package prompt provides a multi-button confirm overlay for the tui/app shell — for questions where a plain yes/no is not enough (e.g. |
|
Package textprompt provides a single-line text-input overlay for the tui/app shell — the third of the overlay kits next to prompt (buttons) and picker (filterable list).
|
Package textprompt provides a single-line text-input overlay for the tui/app shell — the third of the overlay kits next to prompt (buttons) and picker (filterable list). |
|
Package upgrade implements the interactive Shopware upgrade wizard (`shopware-cli project upgrade`): a full-screen Bubble Tea program that walks through readiness checks, target version selection, extension compatibility, plan review, and the guided upgrade execution.
|
Package upgrade implements the interactive Shopware upgrade wizard (`shopware-cli project upgrade`): a full-screen Bubble Tea program that walks through readiness checks, target version selection, extension compatibility, plan review, and the guided upgrade execution. |