Documentation ¶
Overview ¶
Package inkpen composes pencil.Pencil to support colored output including automatic TTY and terminal color detection.
Index ¶
- Variables
- type IconColorFunc
- type Inkpen
- func (i *Inkpen) Compile(v nib.Verbosity, format string, args ...interface{}) string
- func (i *Inkpen) Debugf(msg string, args ...interface{})
- func (i *Inkpen) Enabled(v nib.Verbosity) bool
- func (i *Inkpen) Errorf(msg string, args ...interface{})
- func (i *Inkpen) Fatalf(msg string, args ...interface{})
- func (i *Inkpen) Infof(msg string, args ...interface{})
- func (i *Inkpen) Successf(msg string, args ...interface{})
- func (i *Inkpen) Warnf(msg string, args ...interface{})
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( DefaultDebugColorFunc = color.New(color.FgMagenta).Sprintf DefaultErrorColorFunc = color.New(color.FgRed).Sprintf DefaultFatalColorFunc = color.New(color.FgRed, color.Bold).Sprintf DefaultInfoColorFunc = color.New(color.FgBlue).Sprintf DefaultSuccessColorFunc = color.New(color.FgGreen).Sprintf DefaultWarnColorFunc = color.New(color.FgYellow).Sprintf )
The default inkpen color functions.
var DefaultWriter = color.Output
DefaultWriter is the default inkpen writer. It automatically detects TTY and terminal color support.
Functions ¶
This section is empty.
Types ¶
type IconColorFunc ¶
IconColorFunc is a function to color verbosity level icons.
type Inkpen ¶
Inkpen composes pencil.Pencil to support colored output including automatic TTY and terminal color detection.
func (*Inkpen) Compile ¶
Compile compiles the format and arguments, ensuring a trailing newline, when the given verbosity level is enabled.
func (*Inkpen) Debugf ¶
Debugf writes a debug message and ensures a trailing newline for the given format.
func (*Inkpen) Errorf ¶
Errorf writes a error message and ensures a trailing newline for the given format.
func (*Inkpen) Fatalf ¶
Fatalf writes a fatal message and ensures a trailing newline for the given format.
func (*Inkpen) Infof ¶
Infof writes a information message and ensures a trailing newline for the given format.
type Option ¶
type Option func(*Options)
Option is a inkpen option.
func UseColoredIcons ¶
UseColoredIcons sets whether icons should be colored.
func WithIconColorFuncs ¶
func WithIconColorFuncs(iconColorFuncs map[nib.Verbosity]IconColorFunc) Option
WithIconColorFuncs sets the given ist of inkpen.IconColorFunc.
func WithPencilOptions ¶
WithPencilOptions sets the given list of pencil.Option.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options are all inkpen options.
func NewOptions ¶
NewOptions creates new default inkpen Options and pencil.Options and merges them with the given list of Option. By default the output writer is DefaultWriter and colorization for verbosity level icons is enabled.