output

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package output provides shared rendering helpers for cobra commands. Subcommands hand a typed value to JSON or to a renderer; --json switches the entire program between the two without per-command branching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(ms int64) string

FormatTime renders a millisecond Unix timestamp in local time, or "—" for the epoch (used as a sentinel for "not set").

func JSON

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

JSON encodes v to w as indented JSON followed by a newline.

func Table

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

Table writes a tab-aligned table. headers are uppercased and printed once; rows is a slice of equal-length string slices.

func Truncate

func Truncate(s string, n int) string

Truncate caps a string to a rune length, replacing the tail with an ellipsis. Useful for table cells with chat bodies.

Types

This section is empty.

Jump to

Keyboard shortcuts

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