Documentation
¶
Index ¶
- func SeverityColor(severity, text string) string
- type Format
- type Formatter
- func (f *Formatter) Close() error
- func (f *Formatter) Colored() bool
- func (f *Formatter) Error(format string, args ...any)
- func (f *Formatter) Format() Format
- func (f *Formatter) Info(format string, args ...any)
- func (f *Formatter) Output(data any) error
- func (f *Formatter) Success(format string, args ...any)
- func (f *Formatter) Warning(format string, args ...any)
- func (f *Formatter) Writer() io.Writer
- type Renderable
- type Report
- type Section
- type Table
- type TextSection
- type TextTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeverityColor ¶
SeverityColor returns a colored string based on severity level.
Types ¶
type Format ¶
type Format string
Format represents an output format.
func ParseFormat ¶
ParseFormat converts a string to Format, defaulting to text.
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles output formatting.
func NewFormatter ¶
NewFormatter creates a new formatter.
type Renderable ¶
type Renderable interface {
RenderText(w io.Writer, colored bool) error
RenderMarkdown(w io.Writer) error
// RenderData returns the underlying data for JSON/TOON serialization.
RenderData() any
}
Renderable defines data that can render itself in multiple formats.
type Report ¶
type Report struct {
Title string `json:"title,omitempty" toon:"title"`
Sections []Renderable `json:"-" toon:"-"`
Data any `json:"data,omitempty" toon:"data"`
}
Report is a compound Renderable containing multiple sections and tables.
func (*Report) RenderData ¶
type Section ¶
type Section struct {
Title string `json:"title,omitempty" toon:"title"`
Content string `json:"content,omitempty" toon:"content"`
Sections []Section `json:"sections,omitempty" toon:"sections"`
Data any `json:"data,omitempty" toon:"data"`
}
Section is a Renderable titled section with content and subsections.
func (*Section) RenderData ¶
type Table ¶
type Table struct {
Title string `json:"-" toon:"-"`
Headers []string `json:"-" toon:"-"`
Rows [][]string `json:"-" toon:"-"`
Data any `json:"data,omitempty" toon:"data"`
}
Table is a Renderable table with headers, rows, and optional footer.
func (*Table) RenderData ¶
type TextSection ¶
type TextSection = Section
Click to show internal directories.
Click to hide internal directories.