Documentation ¶
Index ¶
- Variables
- func Bold(msg string) string
- func Boldf(format string, a ...interface{}) string
- func Boldln(a ...interface{}) string
- func Colorize(c *color.Color, msg string) string
- func ColorizeJSON(keyColor *color.Color, valueColor *color.Color, multiline bool, data []byte) []byte
- func DestroySpinner()
- func DisableColor()
- func DisableSpinner()
- func EnableColor()
- func EnableSpinner()
- func Fail(msg string) string
- func Failf(format string, a ...interface{}) string
- func Failln(a ...interface{}) string
- func FgColors() []*color.Color
- func Progress(message string, fn func())
- func Success(msg string) string
- func Successf(format string, a ...interface{}) string
- func Successln(a ...interface{}) string
- func UseSpinner(message string)
- func Warn(msg string) string
- func Warnf(format string, a ...interface{}) string
- func Warnln(a ...interface{}) string
- type Pretty
- func (p *Pretty) Bold(msg string) string
- func (p *Pretty) Boldf(format string, a ...interface{}) string
- func (p *Pretty) Boldln(a ...interface{}) string
- func (p *Pretty) Colorize(c *color.Color, msg string) string
- func (p *Pretty) ColorizeJSON(keyColor *color.Color, valueColor *color.Color, multiline bool, data []byte) []byte
- func (p *Pretty) DestroySpinner()
- func (p *Pretty) DisableColor()
- func (p *Pretty) DisableSpinner()
- func (p *Pretty) EnableColor()
- func (p *Pretty) EnableSpinner()
- func (p *Pretty) Fail(msg string) string
- func (p *Pretty) Failf(format string, a ...interface{}) string
- func (p *Pretty) Failln(a ...interface{}) string
- func (p *Pretty) FgColors() []*color.Color
- func (p *Pretty) Progress(message string, fn func())
- func (p *Pretty) Success(msg string) string
- func (p *Pretty) Successf(format string, a ...interface{}) string
- func (p *Pretty) Successln(a ...interface{}) string
- func (p *Pretty) UseSpinner(message string)
- func (p *Pretty) Warn(msg string) string
- func (p *Pretty) Warnf(format string, a ...interface{}) string
- func (p *Pretty) Warnln(a ...interface{}) string
Constants ¶
This section is empty.
Variables ¶
var ( SuccessSign = pg.Success("✔") WarnSign = pg.Warn("?") FailSign = pg.Fail("⨯") )
Signs to print for success, warn and fail.
var ( FgYellow = color.New(color.FgYellow) FgBlue = color.New(color.FgBlue) FgMagenta = color.New(color.FgMagenta) FgCyan = color.New(color.FgCyan) FgRed = color.New(color.FgRed) FgGreen = color.New(color.FgGreen) FgWhite = color.New(color.FgWhite) )
Predefined colors.
Functions ¶
func Bold ¶
Bold formats using the default formats for its operands and returns the resulting bolded string. Spaces are added between operands when neither is a string.
func Boldln ¶
func Boldln(a ...interface{}) string
Boldln formats using the default formats for its operands and returns the resulting bolded string. Spaces are always added between operands and a newline is appended.
func Colorize ¶
Colorize formats using the default formats for its operands and returns the resulting string with given color. Spaces are added between operands when neither is a string.
func ColorizeJSON ¶
func ColorizeJSON(keyColor *color.Color, valueColor *color.Color, multiline bool, data []byte) []byte
ColorizeJSON colors keys and values of stringified JSON. On errors the original string is returned. If color is nil then key/value won't be colorize.
func Fail ¶
Fail formats using the default formats for its operands and returns the resulting string with fail color foreground. Spaces are added between operands when neither is a string.
func Failf ¶
Failf formats according to a format specifier and returns the resulting string with fail color foreground.
func Failln ¶
func Failln(a ...interface{}) string
Failln formats using the default formats for its operands and returns the resulting string with fail color foreground. Spaces are always added between operands and a newline is appended.
func Progress ¶
func Progress(message string, fn func())
Progress prints spinner with the given message while calling fn function.
func Success ¶
Success formats using the default formats for its operands and returns the resulting string with success color foreground. Spaces are added between operands when neither is a string.
func Successf ¶
Successf formats according to a format specifier and returns the resulting string with success color foreground.
func Successln ¶
func Successln(a ...interface{}) string
Successln formats using the default formats for its operands and returns the resulting string with success color foreground. Spaces are always added between operands and a newline is appended.
func Warn ¶
Warn formats using the default formats for its operands and returns the resulting string with warn color foreground. Spaces are added between operands when neither is a string.
Types ¶
type Pretty ¶
type Pretty struct { *color.Color *spinner.Spinner *prettyjson.Formatter // contains filtered or unexported fields }
Pretty handles pretty printing for terminal and string.
func (*Pretty) Bold ¶
Bold formats using the default formats for its operands and returns the resulting bolded string. Spaces are added between operands when neither is a string.
func (*Pretty) Boldf ¶
Boldf formats according to a format specifier and returns the resulting bolded string.
func (*Pretty) Boldln ¶
Boldln formats using the default formats for its operands and returns the resulting bolded string. Spaces are always added between operands and a newline is appended.
func (*Pretty) Colorize ¶
Colorize formats using the default formats for its operands and returns the resulting string with given color. Spaces are added between operands when neither is a string.
func (*Pretty) ColorizeJSON ¶
func (p *Pretty) ColorizeJSON(keyColor *color.Color, valueColor *color.Color, multiline bool, data []byte) []byte
ColorizeJSON colors keys and values of stringified JSON. On errors the original string is returned. If color is nil then key/value won't be colorize.
func (*Pretty) DestroySpinner ¶
func (p *Pretty) DestroySpinner()
DestroySpinner destroys spinner animation.
func (*Pretty) DisableColor ¶
func (p *Pretty) DisableColor()
DisableColor disables the color output.
func (*Pretty) DisableSpinner ¶
func (p *Pretty) DisableSpinner()
DisableSpinner disables the spinner.
func (*Pretty) Fail ¶
Fail formats using the default formats for its operands and returns the resulting string with fail color foreground. Spaces are added between operands when neither is a string.
func (*Pretty) Failf ¶
Failf formats according to a format specifier and returns the resulting string with fail color foreground.
func (*Pretty) Failln ¶
Failln formats using the default formats for its operands and returns the resulting string with fail color foreground. Spaces are always added between operands and a newline is appended.
func (*Pretty) Success ¶
Success formats using the default formats for its operands and returns the resulting string with success color foreground. Spaces are added between operands when neither is a string.
func (*Pretty) Successf ¶
Successf formats according to a format specifier and returns the resulting string with success color foreground.
func (*Pretty) Successln ¶
Successln formats using the default formats for its operands and returns the resulting string with success color foreground. Spaces are always added between operands and a newline is appended.
func (*Pretty) UseSpinner ¶
UseSpinner uses spinner animation for message.
func (*Pretty) Warn ¶
Warn formats using the default formats for its operands and returns the resulting string with warn color foreground. Spaces are added between operands when neither is a string.