displayers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayText

func DisplayText(item Displayable, out io.Writer, noHeaders bool, includeCols []string) error

DisplayText writes tabbed content to the passed in io.Writer while potentially adding or removing headers.

Types

type Categories

type Categories []*gocancel.Category

func (Categories) ColMap

func (c Categories) ColMap() map[string]string

func (Categories) Cols

func (c Categories) Cols() []string

func (Categories) JSON

func (c Categories) JSON(w io.Writer) error

func (Categories) KV

func (c Categories) KV() []map[string]interface{}

type Displayable

type Displayable interface {
	Cols() []string
	ColMap() map[string]string
	KV() []map[string]interface{}
	JSON(io.Writer) error
}

Displayable is a displayable entity. These are used for printing results.

type Displayer

type Displayer struct {
	OutputType string
	ColumnList string
	NoHeaders  bool

	Item Displayable
	Out  io.Writer
}

Displayer has the display options, the item to display, and where to display to.

func (*Displayer) Display

func (d *Displayer) Display() error

Display ends up rendering the content in one of two formats (text|json)

type Letters

type Letters []*gocancel.Letter

func (Letters) ColMap

func (l Letters) ColMap() map[string]string

func (Letters) Cols

func (l Letters) Cols() []string

func (Letters) JSON

func (l Letters) JSON(w io.Writer) error

func (Letters) KV

func (l Letters) KV() []map[string]interface{}

type Organizations

type Organizations []*gocancel.Organization

func (Organizations) ColMap

func (o Organizations) ColMap() map[string]string

func (Organizations) Cols

func (o Organizations) Cols() []string

func (Organizations) JSON

func (o Organizations) JSON(w io.Writer) error

func (Organizations) KV

func (o Organizations) KV() []map[string]interface{}

type Products added in v0.2.0

type Products []*gocancel.Product

func (Products) ColMap added in v0.2.0

func (o Products) ColMap() map[string]string

func (Products) Cols added in v0.2.0

func (o Products) Cols() []string

func (Products) JSON added in v0.2.0

func (o Products) JSON(w io.Writer) error

func (Products) KV added in v0.2.0

func (o Products) KV() []map[string]interface{}

Jump to

Keyboard shortcuts

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