Documentation
¶
Index ¶
- Constants
- Variables
- func Card(title, content string, opts ...CardOption) string
- func Divider() string
- func FormatBytes(bytes int64) string
- func FormatDate(t time.Time) string
- func FormatDuration(d time.Duration) string
- func LabeledValue(label string, value string) string
- func RenderAgentSummary(agent buildkite.Agent) string
- func RenderAnnotation(annotation *buildkite.Annotation) string
- func RenderArtifact(artifact *buildkite.Artifact) string
- func RenderBuildNumber(state string, number int) string
- func RenderBuildSummary(b *buildkite.Build) string
- func RenderClusterSummary(cluster buildkite.Cluster) string
- func RenderJobSummary(job buildkite.Job) string
- func RenderStatus(state string, opts ...StatusOption) string
- func Row(columns ...string) string
- func Section(title string, content string) string
- func SpacedVertical(strings ...string) string
- func StatusIcon(state string, opts ...StatusOption) string
- func StatusStyle(state string) lipgloss.Style
- func StripHTMLTags(html string) string
- func Table(headers []string, rows [][]string) string
- func TrimMessage(msg string) string
- func TruncateAndStripTags(html string, maxLength int) string
- func TruncateText(text string, maxLength int) string
- type CardOption
- type CardOptions
- type StatusOption
- type StatusOptions
Constants ¶
const ( // Base colors ColorBlack = lipgloss.Color("0") ColorRed = lipgloss.Color("1") ColorGreen = lipgloss.Color("2") ColorYellow = lipgloss.Color("3") ColorBlue = lipgloss.Color("4") ColorPurple = lipgloss.Color("5") ColorCyan = lipgloss.Color("6") ColorWhite = lipgloss.Color("7") ColorGrey = lipgloss.Color("8") // Semantic colors ColorSuccess = lipgloss.Color("#2ECC40") // Green ColorError = lipgloss.Color("#F45756") // Red ColorWarning = lipgloss.Color("#FF841C") // Orange ColorInfo = lipgloss.Color("#337AB7") // Blue ColorDefault = lipgloss.Color("#DDD") // Light Grey ColorRunning = lipgloss.Color("#FF6E00") // Orange ColorPending = lipgloss.Color("#5A5A5A") // Grey ColorPassedGreen = lipgloss.Color("#9dcc3a") // Bright Green )
Color constants for consistent styling across the application
const ( IconSuccess = "✓" IconError = "✖" IconWarning = "⚠" IconInfo = "ℹ" IconRunning = "▶" IconPending = "⏰" IconWaiting = "⌛" IconCanceled = "🚫" IconBlocked = "🔒" IconUnblocked = "🔓" IconNote = "🗒️" IconDefault = "❔" IconEllipsis = "…" )
Icon constants for consistent status representation
const MaxPreviewLength = 120
MaxPreviewLength is the maximum length for content previews
Variables ¶
var ( // Text styles Bold = lipgloss.NewStyle().Bold(true) Italic = lipgloss.NewStyle().Italic(true) Faint = lipgloss.NewStyle().Faint(true) // Layout styles Padding = lipgloss.NewStyle().Padding(0, 1) Header = lipgloss.NewStyle().Bold(true).Padding(0, 1).Underline(true) Title = lipgloss.NewStyle().Bold(true).Padding(0, 0) // Border styles BorderRounded = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()) )
Standard style variants
Functions ¶
func Card ¶
func Card(title, content string, opts ...CardOption) string
Card creates a bordered card with title and content
func FormatBytes ¶
FormatBytes formats bytes into human-readable format (KB, MB, GB, etc.)
func FormatDuration ¶
FormatDuration formats a duration in a human-readable way
func LabeledValue ¶
LabeledValue creates a "Label: Value" formatted string
func RenderAgentSummary ¶
RenderAgentSummary renders a summary of an agent
func RenderAnnotation ¶
func RenderAnnotation(annotation *buildkite.Annotation) string
RenderAnnotation renders a build annotation
func RenderArtifact ¶
RenderArtifact renders a build artifact
func RenderBuildNumber ¶
RenderBuildNumber formats a build number with appropriate styling
func RenderBuildSummary ¶
RenderBuildSummary renders a summary of a build
func RenderClusterSummary ¶
RenderClusterSummary renders a summary of a cluster
func RenderJobSummary ¶
RenderJobSummary renders a summary of a job
func RenderStatus ¶
func RenderStatus(state string, opts ...StatusOption) string
RenderStatus renders a status with the appropriate icon and styling
func SpacedVertical ¶
SpacedVertical joins strings vertically with a blank line between them
func StatusIcon ¶
func StatusIcon(state string, opts ...StatusOption) string
StatusIcon returns the appropriate icon for a status state
func StatusStyle ¶
StatusStyle returns the appropriate styling for a status state
func StripHTMLTags ¶
StripHTMLTags removes HTML tags from a string
func TrimMessage ¶
TrimMessage trims a multi-line message to the first line
func TruncateAndStripTags ¶
TruncateAndStripTags strips HTML tags and truncates text
func TruncateText ¶
TruncateText truncates text to the specified length and adds an ellipsis
Types ¶
type CardOption ¶
type CardOption func(*CardOptions)
CardOption is a function that modifies CardOptions
func WithBorderColor ¶
func WithBorderColor(color lipgloss.Color) CardOption
WithBorderColor sets the border color
type CardOptions ¶
type CardOptions struct {
// contains filtered or unexported fields
}
CardOptions contains options for card rendering
type StatusOption ¶
type StatusOption func(*StatusOptions)
StatusOption is a function that modifies StatusOptions
func WithBlocked ¶
func WithBlocked(blocked bool) StatusOption
WithBlocked indicates the status is blocked
type StatusOptions ¶
type StatusOptions struct {
// contains filtered or unexported fields
}
StatusOptions contains options for status rendering