output

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output handles rendering CLI results in multiple formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DimText

func DimText(s string, noColor bool) string

DimText renders text in dim gray.

func GreenText

func GreenText(s string, noColor bool) string

GreenText renders text in WireLog green.

func PrintQueryResult

func PrintQueryResult(w io.Writer, format Format, data []byte, noColor bool) error

PrintQueryResult renders query results to the writer. For table format, it parses the JSON and renders a styled table. For json/csv/markdown, it writes the raw server response.

func PrintRawJSON

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

PrintRawJSON prints a pre-formed JSON value with indentation.

func PrintSingle

func PrintSingle(w io.Writer, format Format, data map[string]string, noColor bool) error

PrintSingle renders a single object as JSON or key-value pairs.

func PrintStructured

func PrintStructured(w io.Writer, format Format, headers []string, rows [][]string, noColor bool) error

PrintStructured renders non-query data (projects, orgs, health, etc.) in the given format.

func ServerFormat

func ServerFormat(f Format) string

ServerFormat maps a CLI output format to the server's format parameter.

func WarnText

func WarnText(s string, noColor bool) string

WarnText renders text in warning red.

Types

type Format

type Format string

Format represents an output format.

const (
	FormatAuto     Format = "auto"
	FormatTable    Format = "table"
	FormatJSON     Format = "json"
	FormatCSV      Format = "csv"
	FormatMarkdown Format = "markdown"
)

func Detect

func Detect() Format

Detect returns table if stdout is a TTY, json otherwise.

func ResolveFormat

func ResolveFormat(f Format) Format

ResolveFormat resolves "auto" to a concrete format.

Jump to

Keyboard shortcuts

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