prettyprint

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFormat

func HasFormat(fmt Format) bool

HasFormat returns true if the format is supported

Types

type Content

type Content struct {
	Obj      proto.Message
	Format   Format
	Writer   io.Writer
	Template string
}

Content is pretty-printable content

func (*Content) Print

func (pp *Content) Print() error

Print outputs the content to its writer in the given format

type Format

type Format string

Format defines the kind of pretty-printing format we want to use

const JSONFormat Format = "json"

JSONFormat formats everythign as JSON

const (
	// StringFormat uses the Go-builtin stringification for printing
	StringFormat Format = "string"
)
const TemplateFormat Format = "template"

TemplateFormat uses Go templates and tabwriter for formatting content

const YAMLFormat Format = "yaml"

YAMLFormat formats everythign as YAML

Jump to

Keyboard shortcuts

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