render

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package render produces the CLI's output: aligned human tables on a TTY, raw JSON with --json, and progress that degrades to plain lines when piped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTTY

func IsTTY(f *os.File) bool

IsTTY reports whether f is an interactive terminal.

func JSON

func JSON(w io.Writer, v any) error

JSON writes v as indented JSON to w — the machine half of every command.

func JSONError

func JSONError(w io.Writer, code, message string)

JSONError mirrors the API's error envelope on stderr so scripts parse one shape for success and failure alike.

func NewProgress

func NewProgress(out io.Writer, label string, size int64, tty, quiet bool) (io.Writer, func())

NewProgress returns a writer that renders transfer progress to out as the payload is copied through it: a live bar on a TTY, plain milestone lines (every 10%) when piped, nothing when quiet. Call the returned finish when the copy is done.

func Size

func Size(n int64) string

Size humanizes a byte count ("1.4 GB"). Sizes under 1 KB print as bytes.

func Table

func Table(w io.Writer, header []string, rows [][]string)

Table renders rows with aligned columns. header may be nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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