printer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package printer provides a printer abstraction for human readable output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleOutput

type ConsoleOutput interface {
	ConsoleOutput() string
}

type KeyValueError

type KeyValueError struct {
	Key     string
	Message string
}

type ListTree added in v0.5.0

type ListTree struct {
	Text     string
	Children []ListTree
}

type Printer

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

func New

func New(writer io.Writer) *Printer

func (*Printer) FatalError

func (c *Printer) FatalError(err error)

FatalError printer an error message for an unknown or unexpected error. This is used when an error in the system was unexpected, and the error output should be displayed to the user.

If the error implements the ConsoleOutput interface, the ConsoleOutput method will be called to get the error output.

func (*Printer) KeyValueValidationError

func (c *Printer) KeyValueValidationError(title string, errors []KeyValueError)

func (*Printer) LineBreak

func (c *Printer) LineBreak()

func (*Printer) List

func (c *Printer) List(title string, items []string)

List prints a list of items with a title.

Example:

Some Title
  - Item 1
  - Item 2
  - Item 3

func (*Printer) ListTree added in v0.5.0

func (c *Printer) ListTree(title string, list []ListTree)

func (*Printer) StatusList

func (c *Printer) StatusList(title string, items []StatusListItem)

StatusList prints a list of status items with a title.

Example:

Some Title
 ✔ Status 1
 ✘ Status 2
 ✔ Status 3

func (*Printer) Title

func (c *Printer) Title(title string)

func (*Printer) WithBase

func (c *Printer) WithBase(style styles.RenderFunc) *Printer

func (*Printer) WithLight

func (c *Printer) WithLight(style styles.RenderFunc) *Printer

type StatusListItem

type StatusListItem struct {
	Ok     bool
	Status string
}

Jump to

Keyboard shortcuts

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