output

package
v4.2.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package output handles program output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONReader

func JSONReader(i interface{}) io.Reader

JSONReader marshals i as JSON.

Types

type Format

type Format interface {
	Output(io.Writer, io.Reader) error
}

Format is the output format interface.

type FormatArg

type FormatArg interface {
	Arg(string) error
	Required() bool
}

FormatArg is an optional interface. If implemented by a formatter, it may receive an argument.

type Formatter

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

Formatter manages output formatting.

func New

func New() *Formatter

New returns an output formatter instance.

func (*Formatter) ConfigFlags

func (f *Formatter) ConfigFlags(fs *pflag.FlagSet)

ConfigFlags sets up the CLI flags based on the configured formatters.

func (*Formatter) OK

func (f *Formatter) OK() error

OK outputs the 'OK' indication.

func (*Formatter) Output

func (f *Formatter) Output(r io.Reader) error

Output outputs to r.

func (*Formatter) Register

func (f *Formatter) Register(name string, fmt Format)

Register registers an output formatter.

func (*Formatter) UpdateResult

func (f *Formatter) UpdateResult(id, rev string) error

UpdateResult outputs the result of an update.

type FriendlyOutput

type FriendlyOutput interface {
	io.Reader
	Execute(io.Writer) error
}

FriendlyOutput produces friendly output.

func TemplateReader

func TemplateReader(tmpl string, data interface{}, r io.Reader) FriendlyOutput

TemplateReader ...

Directories

Path Synopsis
Package friendly produces friendly-formatted output.
Package friendly produces friendly-formatted output.
Package gotmpl handles go template output.
Package gotmpl handles go template output.
Package json produces JSON output.
Package json produces JSON output.
Package raw produces raw output.
Package raw produces raw output.
Package yaml produces YAML output.
Package yaml produces YAML output.

Jump to

Keyboard shortcuts

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