output

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Colors = map[string]string{
	"red":            "\033[31m",
	"green":          "\033[32m",
	"yellow":         "\033[33m",
	"blue":           "\033[34m",
	"purple":         "\033[35m",
	"cyan":           "\033[36m",
	"white":          "\033[37m",
	"black":          "\033[30m",
	"grey":           "\033[90m",
	"brightRed":      "\033[91m",
	"brightGreen":    "\033[92m",
	"brightYellow":   "\033[93m",
	"brightBlue":     "\033[94m",
	"brightPurple":   "\033[95m",
	"brightCyan":     "\033[96m",
	"brightWhite":    "\033[97m",
	"bgRed":          "\033[41m",
	"bgGreen":        "\033[42m",
	"bgYellow":       "\033[43m",
	"bgBlue":         "\033[44m",
	"bgPurple":       "\033[45m",
	"bgCyan":         "\033[46m",
	"bgWhite":        "\033[47m",
	"bgBlack":        "\033[40m",
	"bgGrey":         "\033[100m",
	"bgBrightRed":    "\033[101m",
	"bgBrightGreen":  "\033[102m",
	"bgBrightYellow": "\033[103m",
	"bgBrightBlue":   "\033[104m",
	"bgBrightPurple": "\033[105m",
	"bgBrightCyan":   "\033[106m",
	"bgBrightWhite":  "\033[107m",
	"bold":           "\033[1m",
	"dim":            "\033[2m",
	"italic":         "\033[3m",
	"underline":      "\033[4m",
	"blink":          "\033[5m",
	"reset":          "\033[0m",
	"pass":           "✓",
	"fail":           "✗",
}

Functions

func Colorize

func Colorize(msg string, color string) string

func DebugMessage

func DebugMessage(msg string) string

func DetailMessage

func DetailMessage(msg string) string

func ErrorMessage

func ErrorMessage(msg string) string

func FormatTitle

func FormatTitle(title string, width int, color string) string

Creates a title with formatting

func InfoMessage

func InfoMessage(msg string) string

func PrintProgress

func PrintProgress(current, total int, width int, color string) string

Prints a simple progress bar

func SuccessMessage

func SuccessMessage(msg string) string

Formatting messages

func WarningMessage

func WarningMessage(msg string) string

Types

type FunctionOutput

type FunctionOutput struct {
	Name        string
	Status      string
	Message     string
	StreamLines []string
	Complete    bool
}

Output of a function

type Manager

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

Output manager

func NewManager

func NewManager(maxStreams int) *Manager

Creates a new output manager

func (*Manager) AddStreamLine

func (m *Manager) AddStreamLine(name, line string)

Adds a single line to a function's stream output

func (*Manager) ClearFunction added in v0.6.4

func (m *Manager) ClearFunction(name string)

Clears the output of a specific function

func (*Manager) ClearLines

func (m *Manager) ClearLines(n int)

Clears 'n' previous lines

func (*Manager) ClearOutput

func (m *Manager) ClearOutput()

Clear the entire screen

func (*Manager) Complete

func (m *Manager) Complete(name string)

Marks a function as complete

func (*Manager) Display

func (m *Manager) Display()

Shows outputs of all current functions

func (*Manager) DisplayTable

func (m *Manager) DisplayTable(name string, innerDividers bool)

Displays a specific table

func (*Manager) GetStatus added in v0.6.4

func (m *Manager) GetStatus(name string) string

Retrieves the status of a function

func (*Manager) GetStatusDisplay

func (m *Manager) GetStatusDisplay(status string) string

Returns a colored status indicator based on status

func (*Manager) GetTable

func (m *Manager) GetTable(name string) *Table

Retrieves a table by name

func (*Manager) Register

func (m *Manager) Register(name string)

Adds a new function to be tracked

func (*Manager) RegisterTable

func (m *Manager) RegisterTable(name string, headers []string) *Table

Adds a table to the manager

func (*Manager) Remove

func (m *Manager) Remove(name string)

Removes a function from the manager

func (*Manager) RemoveCompleted

func (m *Manager) RemoveCompleted()

Removes completed functions from the manager

func (*Manager) RemoveTable

func (m *Manager) RemoveTable(name string)

Removes a table from the manager

func (*Manager) ReportError

func (m *Manager) ReportError(name string, err error)

Sets a function's status to error

func (*Manager) SetMessage

func (m *Manager) SetMessage(name, message string)

Sets the primary message for a function

func (*Manager) SetStatus

func (m *Manager) SetStatus(name, status string)

Updates the status of a function

func (*Manager) UpdateStreamOutput

func (m *Manager) UpdateStreamOutput(name string, output []string)

Adds lines to a function's stream output

type Table

type Table struct {
	Headers []string
	Rows    [][]string
}

func NewTable

func NewTable(headers []string) *Table

func (*Table) AddRow

func (t *Table) AddRow(row []string)

func (*Table) FormatMarkdownTable

func (t *Table) FormatMarkdownTable() string

func (*Table) FormatTable

func (t *Table) FormatTable(innerDividers bool) string

func (*Table) PrintMarkdownTable

func (t *Table) PrintMarkdownTable()

func (*Table) PrintTable

func (t *Table) PrintTable(innerDividers bool)

func (*Table) WriteMarkdownTableToFile

func (t *Table) WriteMarkdownTableToFile(outputPath string) error

Jump to

Keyboard shortcuts

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