outfmt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsJSON

func IsJSON(ctx context.Context) bool

func IsPlain

func IsPlain(ctx context.Context) bool

func KeyValuePayload

func KeyValuePayload(key string, value any) map[string]any

func KeysPayload

func KeysPayload(keys []string) map[string]any

func PathPayload

func PathPayload(path string) map[string]any

func WithMode

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

func WriteJSON

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

func WritePlain

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

WritePlain writes tab-separated values to the writer.

Types

type Mode

type Mode struct {
	JSON  bool
	Plain bool
}

func FromContext

func FromContext(ctx context.Context) Mode

func FromEnv

func FromEnv(envPrefix string) Mode

func FromFlags

func FromFlags(jsonOut bool, plainOut bool) (Mode, error)

type ParseError

type ParseError struct {
	// contains filtered or unexported fields
}

func (*ParseError) Error

func (e *ParseError) Error() string

Jump to

Keyboard shortcuts

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