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.
Click to show internal directories.
Click to hide internal directories.