ui

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetOutput

func SetOutput(o Output)

SetOutput updates logging output

func Start

func Start()

Start starts the logging output

func Stop

func Stop()

Stop halts updating the output

Types

type Debug

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

Debug is log implementation which just outputs line by line

func NewDebug

func NewDebug() *Debug

NewDebug creates new UI which just prints debug output

func (*Debug) NewLine

func (t *Debug) NewLine() Line

NewLine creates new terminal output line what you can change afterward

func (*Debug) Start

func (t *Debug) Start()

Start starts updating the terminal lines

func (*Debug) Stop

func (t *Debug) Stop()

Stop updating the terminal lines

type DebugLine

type DebugLine struct {
}

DebugLine is Line implementation which just outputs all the lines to the terminal

func (*DebugLine) Done

func (r *DebugLine) Done(a ...interface{}) Line

Done marks this line to be done and updates the text

func (*DebugLine) Donef

func (r *DebugLine) Donef(format string, args ...interface{}) Line

Donef marks this line to be done and updates the text

func (*DebugLine) Error

func (r *DebugLine) Error(a ...interface{}) Line

Error mark this line to be in error with given message

func (*DebugLine) Errorf

func (r *DebugLine) Errorf(format string, args ...interface{}) Line

Errorf mark this line to be in error with given format

func (*DebugLine) Fatal

func (r *DebugLine) Fatal(a ...interface{})

Fatal mark this line to be in error with given message Will exit(1) after rerendering the lines

func (*DebugLine) Fatalf

func (r *DebugLine) Fatalf(format string, args ...interface{})

Fatalf mark this line to be in fatal with given format Will exit(1) after rerendering the lines

func (*DebugLine) Info

func (r *DebugLine) Info(a ...interface{}) Line

Info mark this line to be just blank info line

func (*DebugLine) Infof

func (r *DebugLine) Infof(format string, args ...interface{}) Line

Infof mark this line to be just blank info line

func (*DebugLine) Loading

func (r *DebugLine) Loading(a ...interface{}) Line

Loading mark this line to be loading (displays loading indicator)

func (*DebugLine) Loadingf

func (r *DebugLine) Loadingf(format string, args ...interface{}) Line

Loadingf mark this line to be loading (displays loading indicator)

func (*DebugLine) Warn

func (r *DebugLine) Warn(a ...interface{}) Line

Warn mark this line to be in warning with given message

func (*DebugLine) Warnf

func (r *DebugLine) Warnf(format string, args ...interface{}) Line

Warnf mark this line to be in warning with given format

func (*DebugLine) WithProgress

func (r *DebugLine) WithProgress(current, total int64) Line

WithProgress display progress bar when line is in loading state

type Hidden

type Hidden struct {
}

Hidden is log output implementation what doesn't output anything

func NewHidden

func NewHidden() *Hidden

NewHidden creates new hidden log output

func (*Hidden) NewLine

func (h *Hidden) NewLine() Line

NewLine creates new Line what doesn't show up anywhere

func (*Hidden) Start

func (*Hidden) Start()

Start is log Output implementation

func (*Hidden) Stop

func (*Hidden) Stop()

Stop is log Output implementation

func (*Hidden) Update

func (*Hidden) Update()

Update is log Output implementation

type HiddenLine

type HiddenLine struct {
}

HiddenLine is Line implementation which don't output anything

func (*HiddenLine) Done

func (r *HiddenLine) Done(a ...interface{}) Line

Done marks this line to be done and updates the text

func (*HiddenLine) Donef

func (r *HiddenLine) Donef(format string, args ...interface{}) Line

Donef marks this line to be done and updates the text

func (*HiddenLine) Error

func (r *HiddenLine) Error(a ...interface{}) Line

Error mark this line to be in error with given message

func (*HiddenLine) Errorf

func (r *HiddenLine) Errorf(format string, args ...interface{}) Line

Errorf mark this line to be in error with given format

func (*HiddenLine) Fatal

func (r *HiddenLine) Fatal(a ...interface{})

Fatal mark this line to be in error with given message Will exit(1) after rerendering the lines

func (*HiddenLine) Fatalf

func (r *HiddenLine) Fatalf(format string, args ...interface{})

Fatalf mark this line to be in fatal with given format Will exit(1) after rerendering the lines

func (*HiddenLine) Info

func (r *HiddenLine) Info(a ...interface{}) Line

Info mark this line to be just blank info line

func (*HiddenLine) Infof

func (r *HiddenLine) Infof(format string, args ...interface{}) Line

Infof mark this line to be just blank info line

func (*HiddenLine) Loading

func (r *HiddenLine) Loading(a ...interface{}) Line

Loading mark this line to be loading (displays loading indicator)

func (*HiddenLine) Loadingf

func (r *HiddenLine) Loadingf(format string, args ...interface{}) Line

Loadingf mark this line to be loading (displays loading indicator)

func (*HiddenLine) Warn

func (r *HiddenLine) Warn(a ...interface{}) Line

Warn mark this line to be in warning with given message

func (*HiddenLine) Warnf

func (r *HiddenLine) Warnf(format string, args ...interface{}) Line

Warnf mark this line to be in warning with given format

func (*HiddenLine) WithProgress

func (r *HiddenLine) WithProgress(current, total int64) Line

WithProgress display progress bar when line is in loading state

type Line

type Line interface {
	WithProgress(current, total int64) Line
	Infof(format string, args ...interface{}) Line
	Info(a ...interface{}) Line
	Loadingf(format string, args ...interface{}) Line
	Loading(a ...interface{}) Line
	Donef(format string, args ...interface{}) Line
	Done(a ...interface{}) Line
	Warnf(format string, args ...interface{}) Line
	Warn(a ...interface{}) Line
	Errorf(format string, args ...interface{}) Line
	Error(a ...interface{}) Line
	Fatalf(format string, args ...interface{})
	Fatal(a ...interface{})
}

Line represents single ine in terminal output

func NewLine

func NewLine() Line

NewLine creates new updateable output Line

type Output

type Output interface {
	Start()
	Stop()
	NewLine() Line
}

Output is interface for log outputs

type State

type State int

State of the line

const (
	// BLANK is the default state which just displays the text
	BLANK State = iota
	// LOADING state displays loading indicator, you must call Done() or Error()
	LOADING
	// DONE represents that the task were done
	DONE
	// WARN is something should be warned
	WARN
	// ERROR is something went wrong
	ERROR
)

type Terminal

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

Terminal is tracks the Lines and updates all of them when needed

func NewTerminal

func NewTerminal() *Terminal

NewTerminal creates new Terminal UI which prints output to the os.Stdout

func (*Terminal) NewLine

func (t *Terminal) NewLine() Line

NewLine creates new terminal output line what you can change afterward

func (*Terminal) Start

func (t *Terminal) Start()

Start starts updating the terminal lines

func (*Terminal) Stop

func (t *Terminal) Stop()

Stop updating the terminal lines

func (*Terminal) Update

func (t *Terminal) Update()

Update will re-render the output

type TerminalLine

type TerminalLine struct {
	Text string
	// contains filtered or unexported fields
}

TerminalLine is single text line in the terminal output what you can change afterward

func (*TerminalLine) Done

func (r *TerminalLine) Done(a ...interface{}) Line

Done marks this line to be done and updates the text

func (*TerminalLine) Donef

func (r *TerminalLine) Donef(format string, args ...interface{}) Line

Donef marks this line to be done and updates the text

func (*TerminalLine) Error

func (r *TerminalLine) Error(a ...interface{}) Line

Error mark this line to be in error with given message

func (*TerminalLine) Errorf

func (r *TerminalLine) Errorf(format string, args ...interface{}) Line

Errorf mark this line to be in error with given format

func (*TerminalLine) Fatal

func (r *TerminalLine) Fatal(a ...interface{})

Fatal mark this line to be in error with given message Will exit(1) after rerendering the lines

func (*TerminalLine) Fatalf

func (r *TerminalLine) Fatalf(format string, args ...interface{})

Fatalf mark this line to be in fatal with given format Will exit(1) after rerendering the lines

func (*TerminalLine) Info

func (r *TerminalLine) Info(a ...interface{}) Line

Info mark this line to be just blank info line

func (*TerminalLine) Infof

func (r *TerminalLine) Infof(format string, args ...interface{}) Line

Infof mark this line to be just blank info line

func (*TerminalLine) Loading

func (r *TerminalLine) Loading(a ...interface{}) Line

Loading mark this line to be loading (displays loading indicator)

func (*TerminalLine) Loadingf

func (r *TerminalLine) Loadingf(format string, args ...interface{}) Line

Loadingf mark this line to be loading (displays loading indicator)

func (*TerminalLine) Update

func (r *TerminalLine) Update()

Update triggers re-rendering

func (*TerminalLine) Warn

func (r *TerminalLine) Warn(a ...interface{}) Line

Warn mark this line to be in warning with given message

func (*TerminalLine) Warnf

func (r *TerminalLine) Warnf(format string, args ...interface{}) Line

Warnf mark this line to be in warning with given format

func (*TerminalLine) WithProgress

func (r *TerminalLine) WithProgress(current, total int64) Line

WithProgress display progress bar when line is in loading state

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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