Documentation ¶
Index ¶
- Variables
- func BoldBar(curr int) string
- func CmdContext() context.Context
- func Colorize(percent int) *color.Color
- func ColorizeFloat(ratio float64) *color.Color
- func ColorizeInt(used, total int) *color.Color
- func ColorizeInt32(used, total int32) *color.Color
- func ColorizeInt64(used, total int64) *color.Color
- func ColorizeUint32(used, total uint32) *color.Color
- func ColorizeUint32Free(free, total uint32) *color.Color
- func ColorizeUint64(used, total uint64) *color.Color
- func ColorizeUint64Free(free, total uint64) *color.Color
- func Confirm(s string) bool
- func LineBar(curr, width int) string
- func Loader(all int) chan<- int
- func Marshal(v interface{}) ([]byte, error)
- func NewDecoder(r io.Reader) *json.Decoder
- func NewEncoder(w io.Writer) *json.Encoder
- func RawString(v interface{}) string
- func Readable(v interface{}) string
- func Unmarshal(data []byte, val interface{}) error
- type AlternateColor
- type PReader
- type PWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Optimal = color.New(color.FgHiWhite) Normal = color.New(color.FgHiGreen) Loaded = color.New(color.FgHiBlue) Warn = color.New(color.FgHiYellow) Danger = color.New(color.FgHiRed) Dead = color.New(color.FgBlack, color.BgCyan) )
colorize defined
Functions ¶
func CmdContext ¶
CmdContext returns context with special reqest id tag
func ColorizeFloat ¶
ColorizeFloat color by float64 [-1.0, 1.0] ratio
func ColorizeUint32Free ¶
ColorizeUint32Free free by uint32
func ColorizeUint64Free ¶
ColorizeUint64Free free by uint64
func Confirm ¶
Confirm ask for confirmation case insensitive 'y', 'yes', means yes case insensitive 'n', 'no', means no otherwise ask again
Types ¶
type AlternateColor ¶
type AlternateColor struct {
// contains filtered or unexported fields
}
AlternateColor alternate color formatter
func NewAlternateColor ¶
func NewAlternateColor(n int) *AlternateColor
NewAlternateColor returns an alternate color formatter
type PReader ¶
type PReader struct {
// contains filtered or unexported fields
}
PReader progress bar for io.Reader example: reader := NewPReader(1024, r) defer reader.Close() reader.LineBar()
// balabala ...
func NewPReader ¶
NewPReader returns a progress reader
type PWriter ¶
type PWriter struct {
// contains filtered or unexported fields
}
PWriter progress bar for io.Writer
func NewPWriter ¶
NewPWriter returns a progress writer
Click to show internal directories.
Click to hide internal directories.