output

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package output provides formatters for analysis results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	Format(w io.Writer, result *analyze.AnalysisResult) error
}

Formatter writes analysis results to a writer.

func Get

func Get(name string, opts Options) (Formatter, bool)

Get returns a formatter by name. Supported: "json", "table", "markdown"/"md", "llm". Returns the formatter and true if the name was recognized, or the table formatter and false for unknown names.

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter outputs results as indented JSON.

func (JSONFormatter) Format

func (JSONFormatter) Format(w io.Writer, result *analyze.AnalysisResult) error

Format implements Formatter.

type LLMFormatter

type LLMFormatter struct {
	RawOutputPath string // if set, write full JSON to file instead of embedding
}

LLMFormatter produces structured output optimized for LLM consumption. Combines narrative context with raw JSON data.

func (LLMFormatter) Format

func (l LLMFormatter) Format(w io.Writer, result *analyze.AnalysisResult) error

Format implements Formatter.

type MarkdownFormatter

type MarkdownFormatter struct {
	Verbose bool
}

MarkdownFormatter outputs results as a markdown report.

func (MarkdownFormatter) Format

Format implements Formatter.

type Options

type Options struct {
	Verbose       bool
	RawOutputPath string // if set, write full JSON to this file instead of embedding
}

Options controls formatter behavior.

type Progress

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

Progress writes status updates to stderr. On a TTY, it overwrites the current line. Otherwise, it prints each update on a new line. All methods are safe for concurrent use.

func NewProgress

func NewProgress() *Progress

NewProgress creates a progress writer for stderr.

func (*Progress) Done

func (p *Progress) Done()

Done clears the current status line (on TTY) to make room for final output.

func (*Progress) Log

func (p *Progress) Log(format string, args ...any)

Log prints a permanent line (not overwritten). Clears any in-place status first.

func (*Progress) Status

func (p *Progress) Status(format string, args ...any)

Status writes a transient status line that will be overwritten by the next call. On non-TTY, each status is printed on its own line.

type TableFormatter

type TableFormatter struct {
	Verbose bool
}

TableFormatter outputs results as a human-readable table.

func (TableFormatter) Format

func (t TableFormatter) Format(w io.Writer, result *analyze.AnalysisResult) error

Format implements Formatter.

Jump to

Keyboard shortcuts

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