Help us shape the future of Go! Take the 2026 Go Developer Survey

formatting

package
v0.84.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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFormatFlag

func AddFormatFlag(cmd *cobra.Command, format *Format)

AddFormatFlag registers --format / -f for render format (table, json, yaml, names).

func RenderJson

func RenderJson(writer io.Writer, value any) error

func RenderNames

func RenderNames[T Named](writer io.Writer, items []T) error

func RenderYaml

func RenderYaml(writer io.Writer, value any) error

Types

type Format

type Format string
const (
	FormatTable Format = "table"
	FormatJson  Format = "json"
	FormatYaml  Format = "yaml"
	FormatNames Format = "names"
)

type Named

type Named interface {
	GetName() string
}

Jump to

Keyboard shortcuts

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