term

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GreenHighlight  = color.New(color.FgGreen).SprintFunc()
	RedHighlight    = color.New(color.FgRed).SprintFunc()
	YellowHighlight = color.New(color.FgYellow).SprintFunc()

	MagentaHighlight = color.New(color.FgMagenta).SprintFunc()

	Underline = color.New(color.Underline).SprintFunc()

	Highlight = MagentaHighlight
)

Functions

func ColoredTaskStatus

func ColoredTaskStatus(status baur.TaskStatus) string

func FormatDuration

func FormatDuration(d time.Duration, opts ...FormatOption) string

func FormatSize

func FormatSize(bytes uint64, opts ...FormatOption) string

Types

type FormatOption

type FormatOption func(*fmtSettings)

func FormatBaseWithoutUnitName

func FormatBaseWithoutUnitName(enable bool) FormatOption

FormatBaseWithoutUnitName when enabled the Format functions return the value in its base unit without unit-name suffix

type Stream

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

Stream is a concurrency-safe output for term.messages.

func NewStream

func NewStream(out io.Writer) *Stream

func (*Stream) ErrPrintf added in v2.1.0

func (s *Stream) ErrPrintf(err error, format string, a ...interface{})

ErrPrintf prints an error with an optional printf-style message. The method prints the error in the format: errorPrefix msg: err

func (*Stream) ErrPrintln added in v2.1.0

func (s *Stream) ErrPrintln(err error, msg ...interface{})

ErrPrintln prints an error with an optional message. The method prints the error in the format: errorPrefix msg: err

func (*Stream) PrintSep

func (s *Stream) PrintSep()

PrintSep prints a separator line

func (*Stream) Printf

func (s *Stream) Printf(format string, a ...interface{})

func (*Stream) Println

func (s *Stream) Println(a ...interface{})

func (*Stream) TaskPrintf

func (s *Stream) TaskPrintf(task *baur.Task, format string, a ...interface{})

TaskPrintf prints a message that is prefixed with '<TASK-NAME>: '

func (*Stream) Write

func (s *Stream) 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