Documentation
¶
Index ¶
- Variables
- func Bool(b bool) string
- func Border(text string) *bytes.Buffer
- func Cb(t string) string
- func Cc(t string) string
- func Ce(t string) string
- func Center(text string, width int) string
- func Cf(t string) string
- func Ci(t string) string
- func Cinf(t string) string
- func Cp(t string) string
- func Cs(t string) string
- func Default(s, def string) string
- func Example(s string) string
- func Highlight(source, lexer, style string) (err error)
- func HighlightWriter(w io.Writer, source, lexer, style string) (err error)
- func JSONStyles(cmd string)
- func NumberizeKeys(keys []string) string
- func Options(s string, opts []string, shorthand bool) (usage string)
- func Required(s string) (usage string)
- func Term() (term string)
- func UnderlineChar(c string) (s string, err error)
- func UnderlineKeys(keys []string) string
- type JSONExample
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Alert = func() string { return color.Error.Sprint("problem:") }
Alert prints "problem:" in Error color.
var Info = func() string { return color.Info.Sprint("info:") }
Info prints "info:" in Info color.
var TestMode = false
TestMode disables piping detection which conflicts with go test
Functions ¶
func Border ¶
Border wraps text around a single line border.
Example ¶
fmt.Printf("%s", Border("hi"))
Output: ┌────┐ │ hi │ └────┘
func HighlightWriter ¶
HighlightWriter writes the highlight syntax of the source string except when piped to stdout.
func JSONStyles ¶
func JSONStyles(cmd string)
JSONStyles prints out a list of available YAML color styles.
func NumberizeKeys ¶
NumberizeKeys uses ANSI to underline and prefix a sequential number in front of each key.
func Term ¶
func Term() (term string)
Term determines the terminal type based on the COLORTERM and TERM environment variables.
func UnderlineChar ¶
UnderlineChar uses ANSI to underline the first character of a string.
func UnderlineKeys ¶
UnderlineKeys uses ANSI to underline the first letter of each key.
Types ¶
type JSONExample ¶
type JSONExample struct { Style struct { Name string `json:"name"` Count int `json:"count"` Default bool `json:"default"` } }
JSONExample is used for previewing color themes
func (JSONExample) String ¶
func (s JSONExample) String(flag string)