output

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package output provides output formatting (JSON, CSV, TSV, human) for pdf-cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputFormat

type OutputFormat string

OutputFormat represents the output format type.

const (
	FormatHuman OutputFormat = ""
	FormatJSON  OutputFormat = "json"
	FormatCSV   OutputFormat = "csv"
	FormatTSV   OutputFormat = "tsv"
)

func ParseOutputFormat

func ParseOutputFormat(s string) OutputFormat

ParseOutputFormat parses a string into an OutputFormat.

type OutputFormatter

type OutputFormatter struct {
	Format OutputFormat
	Writer io.Writer
}

OutputFormatter handles formatted output in various formats.

func NewOutputFormatter

func NewOutputFormatter(format string) *OutputFormatter

NewOutputFormatter creates a new OutputFormatter with the given format.

func (*OutputFormatter) IsStructured

func (f *OutputFormatter) IsStructured() bool

IsStructured returns true if the format is a structured format (JSON, CSV, TSV).

func (*OutputFormatter) Print

func (f *OutputFormatter) Print(data interface{}) error

Print outputs data in the configured format. For JSON, data is marshaled directly. For other formats, data should be a struct or map.

func (*OutputFormatter) PrintTable

func (f *OutputFormatter) PrintTable(headers []string, rows [][]string) error

PrintTable outputs tabular data in the configured format.

Jump to

Keyboard shortcuts

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