Documentation
¶
Index ¶
- func ColorPriority(priority string) string
- func ColorStatus(status string) string
- func ColorType(ticketType string) string
- func Dim(s string) string
- func Error(s string) string
- func Success(s string) string
- func Teal(s string) string
- func Warn(s string) string
- type Formatter
- type JSONFormatter
- type KeyValue
- type TableFormatter
- type YAMLFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorPriority ¶
ColorPriority returns a colorized priority string.
func ColorStatus ¶
ColorStatus returns a colorized status string.
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 ¶
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 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.