out

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package out provides application output related code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrintEnvironment

type PrintEnvironment interface {
	Writable

	// PrintFunc represents printing function implementation
	PrintFunc(w io.Writer, format string, a ...interface{})

	// SprintFunc represents printing to string function implementation
	SprintFunc(format string, a ...interface{}) string

	// NewPrinter creates new printer
	NewPrinter() (Printer, error)
}

PrintEnvironment represents concrete printing environment abstraction

func NewConsoleEnvironment

func NewConsoleEnvironment() PrintEnvironment

NewConsoleEnvironment creates new PrintEnvironment that outputs to console

func NewWriteFileEnvironment

func NewWriteFileEnvironment(path *string, fs afero.Fs, base PrintEnvironment) PrintEnvironment

NewWriteFileEnvironment creates new file output environment

type Printer

type Printer interface {
	Writable
	// Cprint prints data with colorizing support
	Cprint(format string, a ...interface{})
	// Sprintf writes formatted string into another and do cleanup if necessary
	Sprintf(format string, a ...interface{}) string
	// Println prints new line
	Println()
}

Printer represents printing abstraction with colorizing support

func NewPrinter

func NewPrinter(pe PrintEnvironment) Printer

NewPrinter creates new Printer interface instance

type StringEnvironment

type StringEnvironment interface {
	PrintEnvironment
	fmt.Stringer
}

StringEnvironment defines in memory printing environment abstraction

func NewMemoryEnvironment

func NewMemoryEnvironment() StringEnvironment

NewMemoryEnvironment creates new memory PrintEnvironment implementation

type Writable

type Writable interface {
	// Writer gets underlying io.Writer
	Writer() io.WriteCloser
}

Writable represents io.Writer container

Jump to

Keyboard shortcuts

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