output

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output renders predictions and quota to the terminal (table), or to json/jsonl/tsv/csv for machine consumers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HumanDuration

func HumanDuration(sec int) string

func QuotaFooter

func QuotaFooter(q api.Quota, tier string) string

QuotaFooter is the one-line summary printed to stderr after a predict/enrich run, unless quiet. Returns "" when there is no quota to show.

func RenderAgify

func RenderAgify(w io.Writer, f Format, preds []api.AgifyPrediction, withCountry bool) error

RenderAgify writes age predictions in the chosen format.

func RenderGenderize

func RenderGenderize(w io.Writer, f Format, preds []api.GenderizePrediction, withCountry bool) error

RenderGenderize writes gender predictions in the chosen format. withCountry adds the country_id column for tabular formats.

func RenderNationalize

func RenderNationalize(w io.Writer, f Format, preds []api.NationalizePrediction) error

RenderNationalize writes nationality predictions in the chosen format.

func RenderQuota

func RenderQuota(w io.Writer, f Format, rl api.RateLimit, now time.Time) error

RenderQuota writes the quota for the `quota` command. json/jsonl add a computed reset_at; everything else renders the human summary. now is the reference time for reset_at (injectable for tests).

Types

type Format

type Format int

Format is an output format.

const (
	FormatAuto Format = iota
	FormatTable
	FormatJSON
	FormatJSONL
	FormatTSV
	FormatCSV
)

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat parses the -o flag value.

func Resolve

func Resolve(f Format, stdoutIsTTY bool) Format

Resolve turns Auto into table on a TTY and jsonl when piped.

Jump to

Keyboard shortcuts

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