output

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorPriority

func ColorPriority(priority string) string

ColorPriority returns a colorized priority string.

func ColorStatus

func ColorStatus(status string) string

ColorStatus returns a colorized status string.

func ColorType

func ColorType(ticketType string) string

ColorType returns a colorized ticket type string.

func Dim

func Dim(s string) string

Dim returns text in muted gray.

func Error

func Error(s string) string

Error returns text colored in error rust.

func Success

func Success(s string) string

Success returns text colored in success green.

func Teal

func Teal(s string) string

Teal returns text colored in Stompy teal.

func Warn

func Warn(s string) string

Warn returns text colored in warning amber.

Types

type Formatter

type Formatter interface {
	FormatTable(headers []string, rows [][]string) string
	FormatSingle(fields []KeyValue) string
	FormatRaw(data any) string
}

Formatter defines the interface for rendering CLI output in different formats.

func NewFormatter

func NewFormatter(format string) Formatter

NewFormatter returns a Formatter for the given format string. Supported formats: "json", "yaml", "table" (default).

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter renders output as JSON.

func (*JSONFormatter) FormatRaw

func (f *JSONFormatter) FormatRaw(data any) string

FormatRaw renders data as indented JSON.

func (*JSONFormatter) FormatSingle

func (f *JSONFormatter) FormatSingle(fields []KeyValue) string

FormatSingle renders key-value fields as a JSON object.

func (*JSONFormatter) FormatTable

func (f *JSONFormatter) FormatTable(headers []string, rows [][]string) string

FormatTable renders headers and rows as a JSON array of objects.

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue represents a labeled value for single-item display.

type TableFormatter

type TableFormatter struct{}

TableFormatter renders output as ASCII tables with Stompy brand colors.

func (*TableFormatter) FormatRaw

func (f *TableFormatter) FormatRaw(data any) string

FormatRaw renders data as a plain string representation.

func (*TableFormatter) FormatSingle

func (f *TableFormatter) FormatSingle(fields []KeyValue) string

FormatSingle renders key-value pairs as a colored vertical list.

func (*TableFormatter) FormatTable

func (f *TableFormatter) FormatTable(headers []string, rows [][]string) string

FormatTable renders headers and rows as a colored table that fits the terminal.

type YAMLFormatter

type YAMLFormatter struct{}

YAMLFormatter renders output as YAML.

func (*YAMLFormatter) FormatRaw

func (f *YAMLFormatter) FormatRaw(data any) string

FormatRaw renders data as YAML.

func (*YAMLFormatter) FormatSingle

func (f *YAMLFormatter) FormatSingle(fields []KeyValue) string

FormatSingle renders key-value fields as a YAML object.

func (*YAMLFormatter) FormatTable

func (f *YAMLFormatter) FormatTable(headers []string, rows [][]string) string

FormatTable renders headers and rows as a YAML array of objects.

Jump to

Keyboard shortcuts

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