printer

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPrinter is the default Printer, used by Debugf, Printf, and Warnf.
	DefaultPrinter = &ConsolePrinter{
		Reader:  bufio.NewReader(os.Stdin),
		Writer:  os.Stdout,
		Verbose: false,
	}
)

Functions

func Debugf added in v0.2.8

func Debugf(fmt string, args ...interface{})

Debugf is called to print/format debug information.

func Printf added in v0.2.8

func Printf(fmt string, args ...interface{})

Printf is called to print/format information.

func Warnf added in v0.2.8

func Warnf(fmt string, args ...interface{})

Warnf is called to print/format a warning.

Types

type CLI

type CLI interface {
	Printer
	StartDomain(domain string)
	StartDNSProvider(name string, skip bool)
	EndProvider(numCorrections int, err error)
	StartRegistrar(name string, skip bool)

	PrintCorrection(n int, c *models.Correction)
	EndCorrection(err error)
	PromptToRun() bool
}

CLI is an abstraction around the CLI.

type ConsolePrinter

type ConsolePrinter struct {
	Reader *bufio.Reader
	Writer io.Writer

	Verbose bool
}

ConsolePrinter is a handle for the console printer.

func (ConsolePrinter) Debugf

func (c ConsolePrinter) Debugf(format string, args ...interface{})

Debugf is called to print/format debug information.

func (ConsolePrinter) EndCorrection

func (c ConsolePrinter) EndCorrection(err error)

EndCorrection is called at the end of each correction.

func (ConsolePrinter) EndProvider

func (c ConsolePrinter) EndProvider(numCorrections int, err error)

EndProvider is called at the end of each provider.

func (ConsolePrinter) PrintCorrection

func (c ConsolePrinter) PrintCorrection(i int, correction *models.Correction)

PrintCorrection is called to print/format each correction.

func (ConsolePrinter) Printf added in v0.2.8

func (c ConsolePrinter) Printf(format string, args ...interface{})

Printf is called to print/format information.

func (ConsolePrinter) PromptToRun

func (c ConsolePrinter) PromptToRun() bool

PromptToRun prompts the user to see if they want to execute a correction.

func (ConsolePrinter) StartDNSProvider

func (c ConsolePrinter) StartDNSProvider(provider string, skip bool)

StartDNSProvider is called at the start of each new provider.

func (ConsolePrinter) StartDomain

func (c ConsolePrinter) StartDomain(domain string)

StartDomain is called at the start of each domain.

func (ConsolePrinter) StartRegistrar

func (c ConsolePrinter) StartRegistrar(provider string, skip bool)

StartRegistrar is called at the start of each new registrar.

func (ConsolePrinter) Warnf

func (c ConsolePrinter) Warnf(format string, args ...interface{})

Warnf is called to print/format a warning.

type Printer

type Printer interface {
	Debugf(fmt string, args ...interface{})
	Printf(fmt string, args ...interface{})
	Warnf(fmt string, args ...interface{})
}

Printer is a simple abstraction for printing data. Can be passed to providers to give simple output capabilities.

Jump to

Keyboard shortcuts

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