ui

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MPL-2.0 Imports: 9 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()

	// MarkAllDone marks all progress bars as done
	MarkAllDone()
}

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

type ProgressUpdateFunc added in v0.13.8

type ProgressUpdateFunc func(io.Reader, int64) io.Reader

func CreateProgressUpdater added in v0.13.8

func CreateProgressUpdater(progress Progress, displayName string) ProgressUpdateFunc

CreateProgressUpdater creates a progress update callback method for periodic updates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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