bubbles

package
v0.19.783 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Neutral colors - use terminal's default colors
	BorderColor = styles.BorderInactiveColor

	// Base styles
	BaseStyle = lipgloss.NewStyle().
				Padding(0, 1)

	// Status message styles
	InfoStyle = lipgloss.NewStyle().
				Foreground(styles.InfoColor).
				Bold(true).
				Padding(0, 1)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(styles.ErrorColor).
				Bold(true).
				Padding(0, 1)

	WarningStyle = lipgloss.NewStyle().
					Foreground(styles.WarningColor).
					Bold(true).
					Padding(0, 1)

	SuccessStyle = lipgloss.NewStyle().
					Foreground(styles.SuccessColor).
					Bold(true).
					Padding(0, 1)

	// Interactive styles
	FocusedStyle = lipgloss.NewStyle().
					Foreground(styles.PrimaryColor).
					Bold(true)

	BlurredStyle = lipgloss.NewStyle().
					Foreground(styles.SubtleColor)

	// Border styles: padded but border-less
	BorderStyle = lipgloss.NewStyle().
				Padding(1)

	FocusedBorderStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(styles.PrimaryColor).
						Padding(1, 2)
)

Common styles and colors for consistent theming Using ANSI colors to respect terminal color schemes

View Source
var (
	EvaluationHeaderStyle = lipgloss.NewStyle().
							Foreground(styles.AccentColor).
							Bold(true).
							Underline(true).
							Margin(1, 0)

	EvaluationTipStyle = lipgloss.NewStyle().
						Foreground(styles.InfoColor).
						Italic(true).
						Padding(0, 1)
)

Evaluation journey specific styling

Functions

func Blue

func Blue(text string) string

func ColoredText

func ColoredText(text, color string) string

Helper functions for backward compatibility

func Confirm

func Confirm(prompt string) (bool, error)

Confirm shows a yes/no confirmation dialog

func ConfirmWithDefault

func ConfirmWithDefault(prompt string, defaultYes bool) (bool, error)

ConfirmWithDefault shows a confirmation with a default choice

func DetectUserJourney

func DetectUserJourney(orgName string, userData map[string]interface{}) string

Helper function to detect user journey from org or other data

func EvaluationConfirm

func EvaluationConfirm(prompt string) (bool, error)

EvaluationConfirm shows a confirmation with evaluation journey styling

func Green

func Green(text string) string

func LightMagenta

func LightMagenta(text string) string

func Max

func Max(a, b int) int

Helper functions

func Min

func Min(a, b int) int

func ParseOrgSelection

func ParseOrgSelection(selection string) (name, id string)

ParseOrgSelection parses a "Name: ID" formatted string (for backward compatibility)

func PrintBasicText

func PrintBasicText(msg string)

PrintBasicText prints basic text without styling (for backward compatibility)

func PrintContextMessage

func PrintContextMessage(context, message string)

Context-aware messaging

func PrintCurrentStatus

func PrintCurrentStatus(entity, name, id string)

func PrintDivider

func PrintDivider()

func PrintError

func PrintError(err error) error

PrintError prints error messages with appropriate styling and error handling logic

func PrintEvaluationTip

func PrintEvaluationTip(tip string)

func PrintEvaluationWelcome

func PrintEvaluationWelcome(orgName string)

Evaluation journey specific messages

func PrintFormattedMessage

func PrintFormattedMessage(level, prefix, message string, color lipgloss.Color)

Formatted printing functions

func PrintJSON

func PrintJSON(data interface{}) error

JSON output functions

func PrintJSONError

func PrintJSONError(err error)

func PrintLn

func PrintLn(msg string)

PrintLn prints informational messages

func PrintNoItemsMessage

func PrintNoItemsMessage(entity, createCommand string)

func PrintNotFoundMessage

func PrintNotFoundMessage(entity, id, listCommand string)

func PrintNotSetMessage

func PrintNotSetMessage(entity, selectCommand string)

func PrintPlain

func PrintPlain(text string)

PrintPlain outputs plain text (replacement for pterm.Println)

func PrintStep

func PrintStep(step int, total int, message string)

Progress and status indicators

func PrintStyledError

func PrintStyledError(text string)

PrintError outputs error text (replacement for pterm.LightRed)

func PrintStyledHighlight

func PrintStyledHighlight(text string)

PrintHighlight outputs highlighted text (replacement for pterm.LightMagenta)

func PrintStyledInfo

func PrintStyledInfo(text string)

PrintInfo outputs info text (replacement for pterm.LightCyan)

func PrintStyledSuccess

func PrintStyledSuccess(text string)

PrintSuccess outputs success text (replacement for pterm.LightGreen)

func PrintSuccess

func PrintSuccess(msg string)

PrintSuccess prints success messages

func PrintUnsetStatus

func PrintUnsetStatus(entity string)

func PrintWarning

func PrintWarning(msg string)

PrintWarning prints warning messages

func PrintWithColor

func PrintWithColor(msg, color string)

PrintWithColor prints colored text with the specified color

func PrintfError

func PrintfError(format string, args ...interface{})

func PrintfLn

func PrintfLn(format string, args ...interface{})

func PrintfSuccess

func PrintfSuccess(format string, args ...interface{})

func PrintfWarning

func PrintfWarning(format string, args ...interface{})

func PromptWithAutoApprove

func PromptWithAutoApprove(autoApprove bool, msg string, vars ...interface{}) error

PromptWithAutoApprove prompts for confirmation unless auto-approved

func Red

func Red(text string) string

func RenderMarkdownTable

func RenderMarkdownTable(headers []string, rows [][]string) string

RenderMarkdown renders a simple markdown-like table

func RunOnboarding

func RunOnboarding(userJourney string) error

RunOnboarding runs the onboarding flow

func RunSpinnerWithContext

func RunSpinnerWithContext(ctx context.Context, message string, operation func(ctx context.Context) error, json bool) error

RunSpinnerWithContext runs a spinner for the duration of a context operation

func SelectApp

func SelectApp(apps []AppOption) (string, error)

SelectApp shows an application selector

func SelectFromItems

func SelectFromItems(title string, items []SelectorItem) (string, error)

SelectFromItems shows a selector with SelectorItem structs

func SelectFromItemsWithMaxRows

func SelectFromItemsWithMaxRows(title string, items []SelectorItem, maxVisibleRows int) (string, error)

SelectFromItemsWithMaxRows shows a selector with SelectorItem structs and a specific max visible rows

func SelectFromOptions

func SelectFromOptions(title string, options []string) (string, error)

SelectFromOptions shows a selector with simple string options

func SelectFromOptionsWithMaxRows

func SelectFromOptionsWithMaxRows(title string, options []string, maxVisibleRows int) (string, error)

SelectFromOptionsWithMaxRows shows a selector with simple string options and a specific max visible rows

func SelectInstall

func SelectInstall(installs []InstallOption) (string, error)

SelectInstall shows an installation selector

func SelectOrg

func SelectOrg(orgs []OrgOption) (string, error)

SelectOrg shows an organization selector with evaluation journey support

func SelectWorkflow

func SelectWorkflow(workflows []WorkflowOption) (string, error)

SelectWorkflow shows a workflow selector

func ShowConfirmDialog

func ShowConfirmDialog(message string) (bool, error)

Show displays the confirmation dialog and returns the result This provides a pterm-compatible API for easy migration

func ShowEvaluationWelcome

func ShowEvaluationWelcome()

ShowEvaluationWelcome displays the evaluation welcome message

func StyleError

func StyleError(text string) string

StyleError returns error-styled text (replacement for pterm.LightRed())

func StyleHighlight

func StyleHighlight(text string) string

StyleHighlight returns highlighted text (replacement for pterm.LightMagenta())

func StyleInfo

func StyleInfo(text string) string

StyleInfo returns info-styled text (replacement for pterm.LightCyan())

func StyleSuccess

func StyleSuccess(text string) string

StyleSuccess returns success-styled text (replacement for pterm.LightGreen())

func Yellow

func Yellow(text string) string

Types

type AppOption

type AppOption struct {
	ID   string
	Name string
}

type CLIUserError

type CLIUserError struct {
	Msg string
}

CLI User error for custom CLI errors

func (*CLIUserError) Error

func (u *CLIUserError) Error() string

type ConfirmDialogModel

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

ConfirmDialogModel represents an interactive confirmation dialog

func NewConfirmDialog

func NewConfirmDialog(message string) ConfirmDialogModel

NewConfirmDialog creates a new confirmation dialog

func (ConfirmDialogModel) Init

func (m ConfirmDialogModel) Init() tea.Cmd

Init initializes the confirmation dialog

func (ConfirmDialogModel) Result

func (m ConfirmDialogModel) Result() (bool, bool)

Result returns whether the dialog was confirmed

func (ConfirmDialogModel) Update

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

Update handles messages for the confirmation dialog

func (ConfirmDialogModel) View

func (m ConfirmDialogModel) View() string

View renders the confirmation dialog

type ConfirmModel

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

ConfirmModel represents a yes/no confirmation dialog

func NewConfirmModel

func NewConfirmModel(prompt string) ConfirmModel

NewConfirmModel creates a new confirmation model

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

Init initializes the confirmation model

func (ConfirmModel) Result

func (m ConfirmModel) Result() bool

Result returns the confirmation result

func (ConfirmModel) Selected

func (m ConfirmModel) Selected() bool

Selected returns whether a choice was made

func (ConfirmModel) Update

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

Update handles messages for the confirmation model

func (ConfirmModel) View

func (m ConfirmModel) View() string

View renders the confirmation dialog

type FinalRenderMsg

type FinalRenderMsg struct{}

FinalRenderMsg is used to trigger a final render before quitting

type InstallOption

type InstallOption struct {
	ID   string
	Name string
}

type MultiSpinnerModel

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

MultiSpinnerModel manages multiple concurrent spinners

func NewMultiSpinner

func NewMultiSpinner() MultiSpinnerModel

NewMultiSpinner creates a new multi-spinner model

func (*MultiSpinnerModel) AddSpinner

func (m *MultiSpinnerModel) AddSpinner(id, message string)

AddSpinner adds a new spinner to the collection

func (MultiSpinnerModel) AllCompleted

func (m MultiSpinnerModel) AllCompleted() bool

AllCompleted checks if all spinners are completed

func (MultiSpinnerModel) HasErrors

func (m MultiSpinnerModel) HasErrors() bool

HasErrors checks if any spinners completed with errors

func (MultiSpinnerModel) Init

func (m MultiSpinnerModel) Init() tea.Cmd

Init initializes all spinners

func (MultiSpinnerModel) Update

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

Update handles messages for all spinners

func (MultiSpinnerModel) View

func (m MultiSpinnerModel) View() string

View renders all spinners

type MultiSpinnerView

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

MultiSpinnerView provides a high-level interface for managing multiple spinners

func NewMultiSpinnerView

func NewMultiSpinnerView() *MultiSpinnerView

NewMultiSpinnerView creates a new multi-spinner view

func (*MultiSpinnerView) AddSpinner

func (v *MultiSpinnerView) AddSpinner(id, message string)

AddSpinner adds a new spinner

func (*MultiSpinnerView) AllCompleted

func (v *MultiSpinnerView) AllCompleted() bool

AllCompleted checks if all spinners are completed

func (*MultiSpinnerView) CompleteSpinner

func (v *MultiSpinnerView) CompleteSpinner(id string, success bool, finalMsg string)

CompleteSpinner marks a spinner as completed

func (*MultiSpinnerView) HasErrors

func (v *MultiSpinnerView) HasErrors() bool

HasErrors checks if any spinners completed with errors

func (*MultiSpinnerView) Start

func (v *MultiSpinnerView) Start()

Start begins the multi-spinner display

func (*MultiSpinnerView) Stop

func (v *MultiSpinnerView) Stop()

Stop stops the multi-spinner display

func (*MultiSpinnerView) UpdateSpinner

func (v *MultiSpinnerView) UpdateSpinner(id, message string)

UpdateSpinner updates a spinner's message

func (*MultiSpinnerView) Wait

func (v *MultiSpinnerView) Wait()

Wait waits for all spinners to complete

type OnboardingModel

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

OnboardingModel represents the onboarding flow

func NewOnboardingModel

func NewOnboardingModel(userJourney string) OnboardingModel

NewOnboardingModel creates a new onboarding model

func (OnboardingModel) Init

func (m OnboardingModel) Init() tea.Cmd

Init initializes the onboarding model

func (OnboardingModel) Update

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

Update handles messages for the onboarding model

func (OnboardingModel) View

func (m OnboardingModel) View() string

View renders the onboarding interface

type OnboardingStep

type OnboardingStep struct {
	Title       string
	Description string
	Action      string
	Completed   bool
}

OnboardingStep represents a single step in the onboarding flow

type OrgOption

type OrgOption struct {
	ID           string
	Name         string
	IsEvaluation bool
}

Helper types for the selector functions

type RenderCompleteMsg

type RenderCompleteMsg struct{}

RenderCompleteMsg is used to tell bubbletea that the final render is complete TODO(ja): lol wtf

type SelectorItem

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

SelectorItem represents an item in the selector list

func (SelectorItem) Description

func (i SelectorItem) Description() string

func (SelectorItem) FilterValue

func (i SelectorItem) FilterValue() string

Implement list.Item interface

func (SelectorItem) IsEvaluation

func (i SelectorItem) IsEvaluation() bool

func (SelectorItem) Title

func (i SelectorItem) Title() string

func (SelectorItem) Value

func (i SelectorItem) Value() string

type SelectorModel

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

SelectorModel represents the list selection component

func NewSelectorModel

func NewSelectorModel(title string, items []SelectorItem) SelectorModel

NewSelectorModel creates a new selector model

func NewSelectorModelWithMaxRows

func NewSelectorModelWithMaxRows(title string, items []SelectorItem, maxVisibleRows int) SelectorModel

NewSelectorModelWithMaxRows creates a new selector model with a specific max visible rows

func (SelectorModel) Choice

func (m SelectorModel) Choice() string

Choice returns the selected choice value

func (SelectorModel) Init

func (m SelectorModel) Init() tea.Cmd

Init initializes the selector model

func (SelectorModel) Selected

func (m SelectorModel) Selected() bool

Selected returns whether a choice was made

func (SelectorModel) Update

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

Update handles messages for the selector model

func (SelectorModel) View

func (m SelectorModel) View() string

View renders the selector

type SpinnerCompleteMsg

type SpinnerCompleteMsg struct {
	ID       string
	Success  bool
	FinalMsg string
}

SpinnerCompleteMsg is used to mark spinners as completed

type SpinnerModel

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

SpinnerModel represents a spinner with status and message handling

func NewSpinnerModel

func NewSpinnerModel(json bool) SpinnerModel

NewSpinnerModel creates a new spinner model

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model

func (SpinnerModel) Update

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

Update handles messages for the spinner model

func (SpinnerModel) View

func (m SpinnerModel) View() string

View renders the spinner

type SpinnerMsg

type SpinnerMsg string

SpinnerMsg is used to update the spinner message

type SpinnerResult

type SpinnerResult struct {
	Success bool
	Message string
	Error   error
}

SpinnerResult represents the final state of a spinner operation

type SpinnerResultMsg

type SpinnerResultMsg SpinnerResult

SpinnerResultMsg is used to set the final result

type SpinnerState

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

SpinnerState represents the state of an individual spinner

type SpinnerUpdateMsg

type SpinnerUpdateMsg struct {
	ID      string
	Message string
}

SpinnerUpdateMsg is used to update spinner messages

type SpinnerView

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

SpinnerView provides a high-level interface similar to the original spinner_view

func NewSpinnerView

func NewSpinnerView(json bool) *SpinnerView

NewSpinnerView creates a new spinner view

func (*SpinnerView) Fail

func (v *SpinnerView) Fail(err error)

Fail completes the spinner with an error message

func (*SpinnerView) Start

func (v *SpinnerView) Start(text string)

Start begins the spinner with the given message

func (*SpinnerView) Success

func (v *SpinnerView) Success(text string)

Success completes the spinner with a success message

func (*SpinnerView) Update

func (v *SpinnerView) Update(text string)

Update changes the spinner message

type StyledText

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

StyledText provides consistent text styling throughout the application

func NewStyledText

func NewStyledText() *StyledText

NewStyledText creates a new styled text instance

func (*StyledText) Error

func (s *StyledText) Error(text string) string

Error renders text in error style (red, bold)

func (*StyledText) Highlight

func (s *StyledText) Highlight(text string) string

Highlight renders text in highlight style (bright, bold)

func (*StyledText) Info

func (s *StyledText) Info(text string) string

Info renders text in info style (primary color)

func (*StyledText) Print

func (s *StyledText) Print(text string)

Print outputs plain text without styling

func (*StyledText) PrintError

func (s *StyledText) PrintError(text string)

PrintError outputs error-styled text with newline

func (*StyledText) PrintHighlight

func (s *StyledText) PrintHighlight(text string)

PrintHighlight outputs highlight-styled text with newline

func (*StyledText) PrintInfo

func (s *StyledText) PrintInfo(text string)

PrintInfo outputs info-styled text with newline

func (*StyledText) PrintSubtle

func (s *StyledText) PrintSubtle(text string)

PrintSubtle outputs subtle-styled text with newline

func (*StyledText) PrintSuccess

func (s *StyledText) PrintSuccess(text string)

PrintSuccess outputs success-styled text with newline

func (*StyledText) PrintWarning

func (s *StyledText) PrintWarning(text string)

PrintWarning outputs warning-styled text with newline

func (*StyledText) Println

func (s *StyledText) Println(text string)

Println outputs plain text with newline

func (*StyledText) Subtle

func (s *StyledText) Subtle(text string) string

Subtle renders text in subtle style (muted)

func (*StyledText) Success

func (s *StyledText) Success(text string) string

Success renders text in success style (green, bold)

func (*StyledText) Warning

func (s *StyledText) Warning(text string) string

Warning renders text in warning style (yellow, bold)

type TableModel

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

TableModel represents a data table component

func NewInteractiveTableModel

func NewInteractiveTableModel(data [][]string) TableModel

NewInteractiveTableModel creates a new interactive table model

func NewTableModel

func NewTableModel(data [][]string) TableModel

NewTableModel creates a new table model

func (TableModel) Init

func (m TableModel) Init() tea.Cmd

Init initializes the table model

func (TableModel) Update

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

Update handles messages for the table model

func (TableModel) View

func (m TableModel) View() string

View renders the table

type TableView

type TableView struct{}

TableView provides a high-level interface for rendering tables

func NewTableView

func NewTableView() *TableView

NewTableView creates a new table view

func (*TableView) Print

func (v *TableView) Print(msg string)

Print displays a simple message

func (*TableView) Render

func (v *TableView) Render(data [][]string)

Render displays a table with the given data

func (*TableView) RenderInteractive

func (v *TableView) RenderInteractive(data [][]string) error

RenderInteractive displays an interactive table that users can navigate

func (*TableView) RenderKeyValue

func (v *TableView) RenderKeyValue(pairs map[string]string)

RenderKeyValue renders key-value pairs in a table format

func (*TableView) RenderPaging

func (v *TableView) RenderPaging(data [][]string, offset, limit int, hasMore bool)

RenderPaging displays a table with pagination information

type WorkflowOption

type WorkflowOption struct {
	ID     string
	Name   string
	Type   string
	Status string
}

Jump to

Keyboard shortcuts

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