display

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Reset and modifiers
	ColorReset     = "\033[0m"
	ColorBold      = "\033[1m"
	ColorDim       = "\033[2m"
	ColorItalic    = "\033[3m"
	ColorUnderline = "\033[4m"
	ColorBlink     = "\033[5m"
	ColorReverse   = "\033[7m"
	ColorHidden    = "\033[8m"

	// Standard colors
	ColorBlack   = "\033[30m"
	ColorRed     = "\033[31m"
	ColorGreen   = "\033[32m"
	ColorYellow  = "\033[33m"
	ColorBlue    = "\033[34m"
	ColorMagenta = "\033[35m"
	ColorPurple  = "\033[35m" // Alias for Magenta
	ColorCyan    = "\033[36m"
	ColorWhite   = "\033[37m"
	ColorGray    = "\033[90m"

	// Bright colors
	ColorBrightBlack   = "\033[90m"
	ColorBrightRed     = "\033[91m"
	ColorBrightGreen   = "\033[92m"
	ColorBrightYellow  = "\033[93m"
	ColorBrightBlue    = "\033[94m"
	ColorBrightMagenta = "\033[95m"
	ColorBrightPurple  = "\033[95m" // Alias for Bright Magenta
	ColorBrightCyan    = "\033[96m"
	ColorBrightWhite   = "\033[97m"

	// Background colors
	BgBlack   = "\033[40m"
	BgRed     = "\033[41m"
	BgGreen   = "\033[42m"
	BgYellow  = "\033[43m"
	BgBlue    = "\033[44m"
	BgMagenta = "\033[45m"
	BgCyan    = "\033[46m"
	BgWhite   = "\033[47m"

	// Bright background colors
	BgBrightBlack   = "\033[100m"
	BgBrightRed     = "\033[101m"
	BgBrightGreen   = "\033[102m"
	BgBrightYellow  = "\033[103m"
	BgBrightBlue    = "\033[104m"
	BgBrightMagenta = "\033[105m"
	BgBrightCyan    = "\033[106m"
	BgBrightWhite   = "\033[107m"
)

Color codes for terminal output (same as spinner and prompt packages)

View Source
const (
	SymbolSuccess = "✓"
	SymbolError   = "✗"
	SymbolWarning = "⚠"
	SymbolInfo    = "ℹ"
	SymbolDebug   = "●"
	SymbolArrow   = "→"
	SymbolBullet  = "•"
	SymbolCheck   = "✓"
	SymbolCross   = "✗"
	SymbolStar    = "★"
	SymbolHeart   = "♥"
	SymbolDiamond = "◆"
)

Common symbols

Variables

This section is empty.

Functions

func Arrow

func Arrow(message string)

Arrow prints an arrow-prefixed message

func Arrowf

func Arrowf(format string, args ...any)

Arrowf prints a formatted arrow-prefixed message

func Banner(message string)

Banner prints a banner message

func Bold

func Bold(message string)

Bold prints a bold message

func Boldln

func Boldln(message string)

Boldln prints a bold message with newline

func Box

func Box(message string)

Box prints a message in a box

func Bullet

func Bullet(message string)

Bullet prints a bulleted item

func Bulletf

func Bulletf(format string, args ...any)

Bulletf prints a formatted bulleted item

func Clear

func Clear()

Clear clears a line (useful for replacing spinner output)

func Color

func Color(message string, color string)

Color prints a colored message without newline

func ColoredBox

func ColoredBox(message string, color string)

ColoredBox prints a colored message in a box

func ColoredBullet

func ColoredBullet(message string, color string)

ColoredBullet prints a colored bulleted item

func ColoredIndent

func ColoredIndent(level int, message string, color string)

ColoredIndent prints a colored indented message

func ColoredList

func ColoredList(index int, message string, color string)

ColoredList prints a colored numbered list item

func Colorf

func Colorf(color string, format string, args ...any)

Colorf prints a formatted colored message

func Colorln

func Colorln(message string, color string)

Colorln prints a colored message with newline

func Debug

func Debug(message string)

Debug prints a debug message

func Debugf

func Debugf(format string, args ...any)

Debugf prints a formatted debug message

func Done

func Done(message string)

Done prints a completion message

func Donef

func Donef(format string, args ...any)

Donef prints a formatted completion message

func Error

func Error(message string)

Error prints an error message with a cross

func Errorf

func Errorf(format string, args ...any)

Errorf prints a formatted error message

func Field

func Field(key, value string)

Field prints a field in an object-like structure

func Fieldf

func Fieldf(key, format string, args ...any)

Fieldf prints a formatted field

func Header(message string)

Header prints a header message (bold and colored)

func Headerf

func Headerf(format string, args ...any)

Headerf prints a formatted header message

func Highlight

func Highlight(message string, fgColor, bgColor string)

Highlight prints a highlighted message (with background color)

func Indent

func Indent(level int, message string)

Indent prints an indented message

func Indentf

func Indentf(level int, format string, args ...any)

Indentf prints a formatted indented message

func Info

func Info(message string)

Info prints an info message with an info symbol

func Infof

func Infof(format string, args ...any)

Infof prints a formatted info message

func Italic

func Italic(message string)

Italic prints an italic message

func Italicln

func Italicln(message string)

Italicln prints an italic message with newline

func KeyValue

func KeyValue(key, value string)

KeyValue prints a key-value pair

func KeyValuef

func KeyValuef(key, format string, args ...any)

KeyValuef prints a formatted key-value pair

func List

func List(index int, message string)

List prints a numbered list item

func Listf

func Listf(index int, format string, args ...any)

Listf prints a formatted numbered list item

func Markdown added in v0.0.1

func Markdown(content string)

Markdown renders and prints formatted markdown content with colors

func MarkdownChunk added in v0.0.1

func MarkdownChunk(parser *MarkdownChunkParser, chunk string)

MarkdownChunk processes and displays a chunk of markdown text with streaming support

func NewLine

func NewLine(count ...int)

NewLine prints one or more newlines

func ObjectEnd

func ObjectEnd()

ObjectEnd prints the end of an object-like structure

func ObjectStart

func ObjectStart(name string)

ObjectStart prints the start of an object-like structure

func Print

func Print(message string)

Print prints a message without a newline

func Printf

func Printf(format string, args ...any)

Printf prints a formatted message

func Println

func Println(message string)

Println prints a message with a newline

func Progress

func Progress(message string)

Progress prints a progress message

func Progressf

func Progressf(format string, args ...any)

Progressf prints a formatted progress message

func Separator

func Separator()

Separator prints a separator line

func SeparatorWithChar

func SeparatorWithChar(char string, length int)

SeparatorWithChar prints a separator with a custom character

func Step

func Step(current, total int, message string)

Step prints a step indicator (for multi-step processes)

func Stepf

func Stepf(current, total int, format string, args ...any)

Stepf prints a formatted step indicator

func Styled

func Styled(message string, styles ...string)

Styled prints a message with custom styling

func Styledf

func Styledf(format string, styles []string, args ...any)

Styledf prints a formatted styled message

func Styledln

func Styledln(message string, styles ...string)

Styledln prints a styled message with newline

func Subheader

func Subheader(message string)

Subheader prints a subheader message

func Subheaderf

func Subheaderf(format string, args ...any)

Subheaderf prints a formatted subheader message

func Success

func Success(message string)

Success prints a success message with a checkmark

func Successf

func Successf(format string, args ...any)

Successf prints a formatted success message

func Table

func Table(key, value string)

Table prints a simple 2-column table row

func Tablef

func Tablef(key string, format string, args ...any)

Tablef prints a formatted 2-column table row

func Title

func Title(message string)

Title prints a title with a separator line

func Titlef

func Titlef(format string, args ...any)

Titlef prints a formatted title

func Underline

func Underline(message string)

Underline prints an underlined message

func Underlineln

func Underlineln(message string)

Underlineln prints an underlined message with newline

func Warning

func Warning(message string)

Warning prints a warning message with a warning symbol

func Warningf

func Warningf(format string, args ...any)

Warningf prints a formatted warning message

Types

type MarkdownChunkParser added in v0.0.1

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

MarkdownChunkParser holds state for streaming markdown parsing

func NewMarkdownChunkParser added in v0.0.1

func NewMarkdownChunkParser() *MarkdownChunkParser

NewMarkdownChunkParser creates a new streaming markdown parser

func (*MarkdownChunkParser) Flush added in v0.0.1

func (p *MarkdownChunkParser) Flush()

Flush processes any remaining buffered content

func (*MarkdownChunkParser) Reset added in v0.0.1

func (p *MarkdownChunkParser) Reset()

Reset resets the parser state

type MessageType

type MessageType int

Message types

const (
	MessagePlain MessageType = iota
	MessageSuccess
	MessageError
	MessageWarning
	MessageInfo
	MessageDebug
)

Jump to

Keyboard shortcuts

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