output

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Filter

func Filter(objects map[interface{}]interface{}, filterList []string) map[interface{}]interface{}

Types

type Ack

type Ack struct {
	Sections     map[string][]interface{}
	SectionOrder []string
}

func (*Ack) AddItem

func (a *Ack) AddItem(section string, item string)

func (*Ack) AddSection

func (a *Ack) AddSection(name string, items []interface{})

func (*Ack) InitSection

func (a *Ack) InitSection(name string)

func (*Ack) Print

func (a *Ack) Print(writer io.Writer)

type AckBinding

type AckBinding func(map[interface{}]interface{}, *Ack)

type GoTmpl

type GoTmpl struct {
	Objects      map[interface{}]interface{}
	Format       string
	TopLevelKeys bool
}

func NewGoTmpl

func NewGoTmpl(objects map[interface{}]interface{}, format string, topLevelKeys bool) *GoTmpl

func (*GoTmpl) Print

func (m *GoTmpl) Print(writer io.Writer)

type JSON

type JSON struct {
	Objects      map[interface{}]interface{}
	Format       string
	TopLevelKeys bool
}

func NewJSON

func NewJSON(objects map[interface{}]interface{}, format string, topLevelKeys bool) *JSON

func (*JSON) Print

func (j *JSON) Print(writer io.Writer)

type Output

type Output struct {
	Type   string
	Filter []string
	Format string
	// TopLevelKeys is only used for json and gotmpl currently
	TopLevelKeys bool
	TableBinding *TableBinding
	AckBinding   AckBinding
}

func (*Output) AddFlags

func (o *Output) AddFlags(cmd *cobra.Command, defaultOutput string)

func (*Output) ConfiguredOutputTypes added in v0.17.0

func (o *Output) ConfiguredOutputTypes() []string

func (*Output) ConfiguredOutputTypesString added in v0.17.0

func (o *Output) ConfiguredOutputTypesString() string

func (*Output) Print

func (o *Output) Print(objects map[interface{}]interface{})

type Table

type Table struct {
	Headings []interface{}
	Rows     [][]interface{}
}

func NewTable

func NewTable(headings []interface{}, rows [][]interface{}) *Table

func TableFromObjects

func TableFromObjects(objects map[interface{}]interface{}, headings []string, processObjects func(map[interface{}]interface{}, *Table)) *Table

func (*Table) AddHeadings

func (t *Table) AddHeadings(headings ...interface{})

func (*Table) AddHeadingsS

func (t *Table) AddHeadingsS(headings ...string)

func (*Table) AddRow

func (t *Table) AddRow(rowValues ...interface{})

func (*Table) AddRowS

func (t *Table) AddRowS(rowValues ...string)

func (*Table) Print

func (t *Table) Print(writer io.Writer)

type TableBinding

type TableBinding struct {
	Headings       []string
	ProcessObjects func(map[interface{}]interface{}, *Table)
}

type Type added in v0.17.0

type Type string

Type.

const (
	JSONType   Type = "json"
	GoTmplType Type = "template"
	TableType  Type = "table"
	AckType    Type = "ack"
)

These are the different output types.

Jump to

Keyboard shortcuts

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