ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Status symbols
	SymbolSuccess   = "✓" // Checkmark
	SymbolError     = "✗" // X mark
	SymbolWarning   = "⚠" // Warning triangle
	SymbolInfo      = "ℹ" // Info
	SymbolRunning   = "●" // Filled circle
	SymbolStarting  = "◐" // Half-filled circle
	SymbolStopped   = "○" // Empty circle
	SymbolArrow     = "→" // Right arrow
	SymbolBullet    = "•" // Bullet point
	SymbolSparkle   = "✨" // Sparkle (for special messages)
	SymbolRocket    = "🚀" // Rocket (for deployments/starts)
	SymbolPackage   = "📦" // Package (for containers)
	SymbolGear      = "⚙" // Gear (for configuration)
	SymbolDoctor    = "🩺" // Doctor (for health checks)
	SymbolLightbulb = "💡" // Lightbulb (for tips/hints)
)

Variables

View Source
var (
	// ColorPrimary Primary colors
	ColorPrimary   = lipgloss.Color("#7C3AED") // Purple - main brand
	ColorSecondary = lipgloss.Color("#06B6D4") // Cyan - accents

	// ColorSuccess Status colors
	ColorSuccess = lipgloss.Color("#10B981") // Green
	ColorWarning = lipgloss.Color("#F59E0B") // Amber
	ColorError   = lipgloss.Color("#EF4444") // Red
	ColorInfo    = lipgloss.Color("#3B82F6") // Blue

	// ColorRunning State colors
	ColorRunning  = lipgloss.Color("#10B981") // Green
	ColorStarting = lipgloss.Color("#F59E0B") // Amber
	ColorStopped  = lipgloss.Color("#6B7280") // Gray
	ColorFailed   = lipgloss.Color("#EF4444") // Red

	// ColorText Text colors
	ColorText     = lipgloss.Color("#E5E7EB") // Light gray
	ColorTextDim  = lipgloss.Color("#9CA3AF") // Dim gray
	ColorTextBold = lipgloss.Color("#F9FAFB") // Almost white

	// ColorBgDark Background colors
	ColorBgDark    = lipgloss.Color("#1F2937") // Dark gray
	ColorBgMedium  = lipgloss.Color("#374151") // Medium gray
	ColorBgLight   = lipgloss.Color("#4B5563") // Light gray
	ColorBgSuccess = lipgloss.Color("#064E3B") // Dark green
	ColorBgError   = lipgloss.Color("#7F1D1D") // Dark red
)
View Source
var (
	// StyleBold Text styles
	StyleBold = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorTextBold)

	StyleDim = lipgloss.NewStyle().
				Foreground(ColorTextDim)

	StyleCode = lipgloss.NewStyle().
				Foreground(ColorSecondary).
				Background(ColorBgDark).
				Padding(0, 1)

	// StyleSuccess Status styles
	StyleSuccess = lipgloss.NewStyle().
					Foreground(ColorSuccess).
					Bold(true)

	StyleWarning = lipgloss.NewStyle().
					Foreground(ColorWarning).
					Bold(true)

	StyleError = lipgloss.NewStyle().
				Foreground(ColorError).
				Bold(true)

	StyleInfo = lipgloss.NewStyle().
				Foreground(ColorInfo).
				Bold(true)

	// StyleSuccessBox Box styles for callouts
	StyleSuccessBox = lipgloss.NewStyle().
					Foreground(ColorSuccess).
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorSuccess).
					Padding(0, 1)

	StyleErrorBox = lipgloss.NewStyle().
					Foreground(ColorError).
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorError).
					Padding(0, 1)

	StyleInfoBox = lipgloss.NewStyle().
					Foreground(ColorInfo).
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorInfo).
					Padding(0, 1)

	// StyleHeader Header styles
	StyleHeader = lipgloss.NewStyle().
				Foreground(ColorPrimary).
				Bold(true).
				Underline(true).
				MarginBottom(1)

	StyleSubheader = lipgloss.NewStyle().
					Foreground(ColorSecondary).
					Bold(true)
)

Functions

func Bold

func Bold(text string) string

Bold returns bolded text

func Code

func Code(text string) string

Code returns text styled as code/command

func Dim

func Dim(text string) string

Dim returns dimmed text

func EmptyLine

func EmptyLine()

EmptyLine prints a blank line for spacing

func Error

func Error(message string)

Error prints an error message with X mark

func ErrorBox

func ErrorBox(message string)

ErrorBox prints an error message in a box

func FormatLogLine

func FormatLogLine(line string, showTimestamps bool) string

FormatLogLine formats a single log line with appropriate color coding

func FormatServiceHeader

func FormatServiceHeader(serviceName, containerID string, isStreaming bool) string

FormatServiceHeader formats a header for log output showing service name and container ID

func FormatServiceStatus

func FormatServiceStatus(status string) string

FormatServiceStatus formats a service status with an appropriate color and symbol

func FormatStreamingFooter

func FormatStreamingFooter() string

FormatStreamingFooter shows a footer when streaming is active

func Header(message string)

Header prints a section header

func HealthCheckTable

func HealthCheckTable(category string, rows []HealthCheckRow) string

HealthCheckTable creates a table for health check results

func Highlight

func Highlight(text string) string

Highlight returns text in the primary brand color

func Hint

func Hint(message string)

Hint prints a helpful hint/tip with lightbulb

func Info

func Info(message string)

Info prints an info message with an info symbol

func InfoBox

func InfoBox(message string)

InfoBox prints an info message in a box

func KeyValueTable

func KeyValueTable(title string, rows []KeyValueRow) string

KeyValueTable creates a simple two-column table for configuration display

func List

func List(item string)

List prints a bulleted list item

func ListItem

func ListItem(prefix, item string)

ListItem prints a bulleted list item with a custom prefix

func PortTable

func PortTable(rows []PortRow) string

PortTable creates and renders a table for port allocations

func RenderList

func RenderList(title string, items []string) string

RenderList renders a simple styled list

func RenderNumberedList

func RenderNumberedList(title string, items []string) string

RenderNumberedList renders a numbered list

func Separator

func Separator()

Separator prints a visual separator line

func ServiceTable

func ServiceTable(projectName string, rows []ServiceRow) string

ServiceTable creates and renders a beautiful table for services

func StatusFailed

func StatusFailed(text string) string

StatusFailed returns a formatted "failed" status

func StatusRunning

func StatusRunning(text string) string

StatusRunning returns a formatted "running" status

func StatusStarting

func StatusStarting(text string) string

StatusStarting returns a formatted "starting" status

func StatusStopped

func StatusStopped(text string) string

StatusStopped returns a formatted "stopped" status

func Subheader

func Subheader(message string)

Subheader prints a subsection header

func Success

func Success(message string)

Success prints a success message with a checkmark

func SuccessBox

func SuccessBox(message string)

SuccessBox prints a success message in a box

func Warning

func Warning(message string)

Warning prints a warning message with a warning symbol

func WithProgress

func WithProgress(message string, fn func() error) error

WithProgress wraps a long-running operation with a spinner

Types

type HealthCheckRow

type HealthCheckRow struct {
	Check  string
	Status string // "pass", "fail", "warn"
	Detail string
}

HealthCheckRow represents a health check result

type KeyValueRow

type KeyValueRow struct {
	Key   string
	Value string
}

KeyValueRow represents a key-value pair

type LogLevel

type LogLevel int

LogLevel represents the severity of a log message

const (
	LogLevelUnknown LogLevel = iota
	LogLevelTrace
	LogLevelDebug
	LogLevelInfo
	LogLevelWarn
	LogLevelError
	LogLevelFatal
)

type PortRow

type PortRow struct {
	Port    string
	Service string
	Project string
	Host    string
}

PortRow represents a single row in the port allocation table

type ProgressTracker

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

ProgressTracker tracks progress through multiple steps

func NewProgressTracker

func NewProgressTracker(steps []string) *ProgressTracker

NewProgressTracker creates a new progress tracker

func (*ProgressTracker) Complete

func (p *ProgressTracker) Complete(message string)

Complete marks all steps as complete

func (*ProgressTracker) Fail

func (p *ProgressTracker) Fail(message string)

Fail marks the progress as failed

func (*ProgressTracker) NextStep

func (p *ProgressTracker) NextStep()

NextStep advances to the next step and prints progress

func (*ProgressTracker) Start

func (p *ProgressTracker) Start()

Start prints the initial progress state

type ServiceRow

type ServiceRow struct {
	Service     string
	Status      string
	Ports       []string
	ContainerID string
	Uptime      string
}

ServiceRow represents a single row in the service table

type Spinner

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

Spinner represents a simple terminal spinner for indicating progress

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner with a message

func ShowSpinner

func ShowSpinner(message string) *Spinner

ShowSpinner creates, starts, and returns a spinner (convenience function)

func (*Spinner) Error

func (s *Spinner) Error(message string)

Error stops the spinner and shows an error message

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner and clears the line

func (*Spinner) Success

func (s *Spinner) Success(message string)

Success stops the spinner and shows a success message

func (*Spinner) UpdateMessage

func (s *Spinner) UpdateMessage(message string)

UpdateMessage changes the spinner message while it's running

func (*Spinner) Warning

func (s *Spinner) Warning(message string)

Warning stops the spinner and shows a warning message

func (*Spinner) WithArrow

func (s *Spinner) WithArrow() *Spinner

WithArrow creates a spinner with arrow frames

func (*Spinner) WithCircle

func (s *Spinner) WithCircle() *Spinner

WithCircle creates a spinner with circle frames

func (*Spinner) WithColor

func (s *Spinner) WithColor(color lipgloss.Color) *Spinner

WithColor sets a custom color for the spinner

func (*Spinner) WithDots

func (s *Spinner) WithDots() *Spinner

WithDots creates a spinner with dot frames (default)

func (*Spinner) WithLine

func (s *Spinner) WithLine() *Spinner

WithLine creates a spinner with line frames

Jump to

Keyboard shortcuts

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