printer

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(format string, a ...interface{}) (n int, err error)

Errorf formats according to a format specifier and writes to standard output using the provided info color.

func Errorln

func Errorln(format string, a ...interface{}) (n int, err error)

Errorln formats using the default formats for its operands and writes to standard output using the provided info color.

func Infof

func Infof(format string, a ...interface{}) (n int, err error)

Infof formats according to a format specifier and writes to standard output using the provided info color.

func Infoln

func Infoln(a ...interface{}) (n int, err error)

Infoln formats using the default formats for its operands and writes to standard output using the provided info color.

func Warnf

func Warnf(format string, a ...interface{}) (n int, err error)

Warnf formats according to a format specifier and writes to standard output using the provided info color.

func Warnln

func Warnln(format string, a ...interface{}) (n int, err error)

Warnln formats using the default formats for its operands and writes to standard output using the provided info color.

Types

type Config

type Config func(*Printer)

Config can be eaily used as spread function parameter

func DefaultColor

func DefaultColor(c *color.Color) Config

DefaultColor sets default CLI color

func ErrorColor

func ErrorColor(c *color.Color) Config

ErrorColor sets error CLI color

func InfoColor

func InfoColor(c *color.Color) Config

InfoColor sets informational CLI color

func Silent

func Silent(silent bool) Config

Silent sets printer silent mode

func WarnColor

func WarnColor(c *color.Color) Config

WarnColor sets warn CLI color

type Printer

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

Printer struct

func New

func New(colors ...Config) (*Printer, func())

New returns a configured printer and a close function. The close function deallocates an inner os.DevNull io.Writer.

Usage:

print, close := printer.New(false, printer.InfoColor(color.New(color.FgWhite, color.Bold)))

defer close()

func (*Printer) Close

func (p *Printer) Close()

Close stdout file descriptor

func (*Printer) Errorf

func (p *Printer) Errorf(format string, a ...interface{}) (n int, err error)

Errorf formats according to a format specifier and writes to standard output using the provided info color.

func (*Printer) Errorln

func (p *Printer) Errorln(a ...interface{}) (n int, err error)

Errorln formats using the default formats for its operands and writes to standard output using the provided info color.

func (*Printer) Infof

func (p *Printer) Infof(format string, a ...interface{}) (n int, err error)

Infof formats according to a format specifier and writes to standard output using the provided info color.

func (*Printer) Infoln

func (p *Printer) Infoln(a ...interface{}) (n int, err error)

Infoln formats using the default formats for its operands and writes to standard output using the provided info color.

func (*Printer) Warnf

func (p *Printer) Warnf(format string, a ...interface{}) (n int, err error)

Warnf formats according to a format specifier and writes to standard output using the provided info color.

func (*Printer) Warnln

func (p *Printer) Warnln(a ...interface{}) (n int, err error)

Warnln formats using the default formats for its operands and writes to standard output using the provided info color.

Jump to

Keyboard shortcuts

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