output

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package output renders Bot API JSON results in table/json/yaml/csv. One renderer serves every command, driven by JSON normalization: an object becomes one row, an array of objects becomes many, nested fields flatten to dotted keys. Output is deterministic (preferred-key order then alphabetical) and pipe-clean (notes go to stderr) per the cliwright standard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(data json.RawMessage, opts Options) error

Render writes data in the requested format. data is the raw Bot API `result`.

Types

type Format

type Format string

Format is an output format.

const (
	FormatTable Format = "table"
	FormatJSON  Format = "json"
	FormatYAML  Format = "yaml"
	FormatCSV   Format = "csv"
	FormatID    Format = "id"
)

func (Format) Valid

func (f Format) Valid() bool

Valid reports whether f is a known format.

type Options

type Options struct {
	Format  Format
	Columns []string // explicit column selection (overrides the preferred order)
	NoColor bool
	Quiet   bool
	JQ      string // optional gojq expression applied before rendering
	MaxCols int    // cap auto-detected columns (default 10)
	Out     io.Writer
	Err     io.Writer
}

Options configure a single Render call.

Jump to

Keyboard shortcuts

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