output

package
v0.0.0-...-743f219 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SPINCHARS = []string{"⠋", "⠙", "⠚", "⠒", "⠂", "⠂", "⠒", "⠲", "⠴", "⠦", "⠖", "⠒", "⠐", "⠐", "⠒", "⠓", "⠋"}

Functions

func WithSimpleContainer

func WithSimpleContainer(title string, header func(string) string, plain bool,
	toRun func(o Output) error) (err error)

func WithStdout

func WithStdout(title string, c Container, toRun func(o Output) error) (err error)

Types

type Container

type Container interface {
	Start()
	Stop()
	AddOutput(name string) Output
}

func NewContainer

func NewContainer(headerFunc func(string) string, titlePrefix string, plain bool) (c Container)

type InteractiveContainer

type InteractiveContainer struct {
	Out             io.Writer
	Spinners        []*Spinner
	RefreshInterval time.Duration
	// contains filtered or unexported fields
}

func (*InteractiveContainer) AddOutput

func (c *InteractiveContainer) AddOutput(name string) Output

func (*InteractiveContainer) Listen

func (c *InteractiveContainer) Listen()

func (*InteractiveContainer) Start

func (c *InteractiveContainer) Start()

func (*InteractiveContainer) Stop

func (c *InteractiveContainer) Stop()

type LogContainer

type LogContainer struct {
	Out     io.Writer
	Outputs []*LogOutput
	// contains filtered or unexported fields
}

func (*LogContainer) AddOutput

func (lc *LogContainer) AddOutput(name string) Output

func (*LogContainer) Start

func (lc *LogContainer) Start()

func (*LogContainer) Stop

func (lc *LogContainer) Stop()

type LogOutput

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

func (*LogOutput) Error

func (lo *LogOutput) Error(err error)

func (*LogOutput) Finished

func (lo *LogOutput) Finished(msg string)

func (*LogOutput) Start

func (lo *LogOutput) Start()

func (*LogOutput) Success

func (lo *LogOutput) Success(msg string)

func (*LogOutput) Write

func (lo *LogOutput) Write(p []byte) (int, error)

type Output

type Output interface {
	Write(p []byte) (int, error)
	Start()
	Finished(string)
	Success(string)
	Error(error)
}

type Spinner

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

func NewSpinner

func NewSpinner(name string) *Spinner

func (*Spinner) Error

func (s *Spinner) Error(err error)

func (*Spinner) Finished

func (s *Spinner) Finished(msg string)

func (*Spinner) Spin

func (s *Spinner) Spin()

func (*Spinner) Start

func (s *Spinner) Start()

func (*Spinner) String

func (s *Spinner) String() string

func (*Spinner) Success

func (s *Spinner) Success(msg string)

func (*Spinner) Write

func (s *Spinner) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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