outfmt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package outfmt provides context-based output mode selection (JSON vs human).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsJSON

func IsJSON(ctx context.Context) bool

IsJSON returns true if the context has JSON output mode enabled.

func WithMode

func WithMode(ctx context.Context, mode Mode) context.Context

WithMode stores the output mode in the context.

func WriteJSON

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

WriteJSON writes v as pretty-printed JSON to w.

Types

type Mode

type Mode struct {
	JSON bool
}

Mode controls output formatting.

Jump to

Keyboard shortcuts

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