output

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output formats CLI responses as table, json, csv, or raw. Table and CSV output respect Options.Fields, including dotted paths like "event.title" that traverse nested maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyJSONBytes

func PrettyJSONBytes(b []byte) []byte

PrettyJSONBytes reformats raw JSON with 2-space indentation. Invalid JSON is returned unchanged so callers can use it as a best-effort formatter on untrusted input.

func Write

func Write(w io.Writer, obj any, opts Options) error

Write renders obj to w according to opts.Format. Returns an error for unknown formats or write failures.

Types

type Options

type Options struct {
	Format string
	Fields []string
}

Options controls how Write renders an object.

Format is one of "table" (default), "json", "csv", or "raw". Fields is the explicit column list for table/csv output; empty means auto-select preferred columns from the response.

Jump to

Keyboard shortcuts

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