output

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

pkg/output/json.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() (out []string)

user-facing list, e.g. for --help

func Print

func Print(format string, jsonBytes []byte) error

Convenience helper used by commands.

func Register

func Register(name string, p Printer)

Register lets you plug-in new printers from init() funcs.

Types

type HumanPrinter

type HumanPrinter struct{}

func (HumanPrinter) Print

func (HumanPrinter) Print(raw []byte) error

type JSONPrinter

type JSONPrinter struct{}

func (JSONPrinter) Print

func (JSONPrinter) Print(b []byte) error

type PrettyPrinter

type PrettyPrinter struct{}

func (PrettyPrinter) Print

func (PrettyPrinter) Print(raw []byte) error

type Printer

type Printer interface {
	Print(jsonBytes []byte) error
}

Printer prints a marshalled JSON payload to the terminal in some format.

func Get

func Get(format string) Printer

Get returns the requested printer or falls back to plain JSON.

type YAMLPrinter

type YAMLPrinter struct{}

func (YAMLPrinter) Print

func (YAMLPrinter) Print(b []byte) error

Jump to

Keyboard shortcuts

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