Documentation ¶
Index ¶
- Constants
- Variables
- func Colorize(c *color.Color, noColor bool, msg string, values ...interface{}) string
- func ColorizedNoLogOutput(c *color.Color, msg string, values ...interface{})
- func ColorizedOutput(c *color.Color, msg string, values ...interface{})
- func DoProgress() bool
- func IsTerminal() bool
- func Link(text string, url string) string
- func SleepBeforeError(ctx context.Context)
- type Progress
- type ProgressUpdateFunc
- type Table
Constants ¶
View Source
const ( StatusOK = "ok" StatusError = "error" StatusWarn = "warn" StatusInProgress = "in_progress" StatusInfo = "info" )
Variables ¶
View Source
var ( ColorTrace = color.New(color.FgMagenta, color.Bold) ColorDebug = color.New(color.FgWhite, color.Faint) 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) ColorUnderline = color.New(color.Underline) )
Functions ¶
func ColorizedNoLogOutput ¶ added in v0.23.0
func ColorizedOutput ¶
ColorizedOutput outputs a colored message directly to the terminal. The remaining arguments should be interpolations for the format string.
func DoProgress ¶ added in v0.22.3
func DoProgress() bool
func IsTerminal ¶
func IsTerminal() bool
func SleepBeforeError ¶ added in v0.22.3
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
func CreateProgressUpdater ¶ added in v0.13.8
func CreateProgressUpdater(progress Progress, displayName string) ProgressUpdateFunc
CreateProgressUpdater creates a progress update callback method for periodic updates.
Click to show internal directories.
Click to hide internal directories.