ui

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK         = "ok"
	StatusError      = "error"
	StatusWarn       = "warn"
	StatusInProgress = "in_progress"
)

Variables

View Source
var (
	ColorHeader       = color.New(color.Bold)
	ColorInfo         = color.New()
	ColorProgress     = color.New(color.FgCyan)
	ColorProgressBold = color.New(color.FgCyan, color.Bold)
	ColorError        = color.New(color.FgRed)
	ColorErrorBold    = color.New(color.FgRed, color.Bold)
	ColorSuccess      = color.New(color.FgGreen)
	ColorSuccessBold  = color.New(color.FgGreen, color.Bold)
	ColorWarning      = color.New(color.FgYellow)
	ColorWarningBold  = color.New(color.FgYellow, color.Bold)
)

Functions

func ColorizedOutput

func ColorizedOutput(c *color.Color, msg string, values ...interface{})

ColorizedOutput outputs a colored message directly to the terminal. The remaining arguments should be interpolations for the format string.

func IsTerminal

func IsTerminal() bool

Types

type Progress

type Progress interface {
	// Add adds an additional bar to the progress
	Add(id, displayName, message string, total int64)

	// Update bars status, message and amount
	Update(id, status, msg string, amount int)

	// Increment the progress by given amount
	Increment(id string, amount int)

	// AttachReader to a progress so when an io is read the bar will update as well
	AttachReader(id string, data io.Reader) io.Reader

	// Wait for all progress bars to finish
	Wait()
}

Progress is used to provide an updating progress to the user. The progress usually has one or more bars

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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