printer

package
v1.17.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package printer contains the definition of the Printer interface and the implementation of all the available printers implementing it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultPrinter

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

DefaultPrinter defines the DefaultPrinter configuration.

func (*DefaultPrinter) Print

func (p *DefaultPrinter) Print(w io.Writer, root *resource.Resource) error

Print implements the Printer interface by prints the resource tree in a human-readable format.

type DotPrinter

type DotPrinter struct{}

DotPrinter defines the DotPrinter configuration.

func (*DotPrinter) Print

func (p *DotPrinter) Print(w io.Writer, root *resource.Resource) error

Print gets all the nodes and then return the graph as a dot format string to the Writer.

type JSONPrinter

type JSONPrinter struct{}

JSONPrinter is a printer that prints the resource graph as JSON.

func (*JSONPrinter) Print

func (p *JSONPrinter) Print(w io.Writer, root *resource.Resource) error

Print implements the Printer interface.

type Printer

type Printer interface {
	Print(w io.Writer, r *resource.Resource) error
}

Printer implements the interface which is used by all printers in this package.

func New

func New(typeStr string) (Printer, error)

New creates a new printer based on the specified type.

type Type

type Type string

Type represents the type of printer.

const (
	TypeDefault Type = "default"
	TypeWide    Type = "wide"
	TypeJSON    Type = "json"
	TypeDot     Type = "dot"
)

Implemented PrinterTypes.

Jump to

Keyboard shortcuts

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