render

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Overview

Package render selects which output format cmd/plat uses for a lookup and detects whether stdout is an interactive terminal. It does not import internal/render/plain, internal/render/human, or internal/render/machine itself — the caller (cmd/plat) dispatches to the right one based on the Format this package returns, keeping this leaf package free of all three renderers' dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMachine

func IsMachine(f Format) bool

IsMachine reports whether f is one of the JSON/NDJSON machine formats.

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal reports whether f is connected to an interactive terminal.

Types

type Format

type Format int

Format selects which renderer cmd/plat dispatches to: FormatHuman to internal/render/human's styled output, FormatPlain to internal/render/plain's unstyled output, FormatJSON/FormatNDJSON to internal/render/machine's encoder.

const (
	FormatHuman Format = iota
	FormatPlain
	FormatJSON
	FormatNDJSON
)

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat validates the -o/--output flag's value.

func Select

func Select(explicit string, isTTY bool, noColor bool) (Format, error)

Select resolves the format to use: an explicit -o value always wins (including "human" even under NO_COLOR or a non-terminal destination — lipgloss.Fprint's own downsampling strips ANSI in that case, this function never second-guesses an explicit choice). With no explicit value, a TTY with no NO_COLOR gets Human; anything else (a pipe, or NO_COLOR set) gets Plain.

Directories

Path Synopsis
Package human renders a merged domain record as a styled, colorized view for interactive terminals — the FormatHuman counterpart to internal/render/plain's unstyled FormatPlain.
Package human renders a merged domain record as a styled, colorized view for interactive terminals — the FormatHuman counterpart to internal/render/plain's unstyled FormatPlain.
Package machine encodes a model.Record as the stable JSON/NDJSON wire format described in docs/schema.md.
Package machine encodes a model.Record as the stable JSON/NDJSON wire format described in docs/schema.md.

Jump to

Keyboard shortcuts

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