str

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2020 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var Alert = func() string {
	return color.Error.Sprint("problem:")
}

Alert prints "problem:" in Error color.

View Source
var Info = func() string {
	return color.Info.Sprint("info:")
}

Info prints "info:" in Info color.

View Source
var TestMode = false

TestMode disables piping detection which conflicts with go test

Functions

func Bool

func Bool(b bool) string

Bool returns a ✓ or ✗.

func Border

func Border(text string) *bytes.Buffer

Border wraps text around a single line border.

Example
fmt.Printf("%s", Border("hi"))
Output:

┌────┐
│ hi │
└────┘

func Cb

func Cb(t string) string

Cb secondary.

func Cc

func Cc(t string) string

Cc comment.

func Ce

func Ce(t string) string

Ce warn.

func Center

func Center(text string, width int) string

Center align text to the width.

func Cf

func Cf(t string) string

Cf fuzzy.

func Ci

func Ci(t string) string

Ci italic.

func Cinf

func Cinf(t string) string

Cinf info.

func Cp

func Cp(t string) string

Cp primary.

func Cs

func Cs(t string) string

Cs success.

func Default

func Default(s, def string) string

Default appends (default ...) to the usage string.

func Example

func Example(s string) string

Example is intended for the cobra.Command Example fields.

func Highlight

func Highlight(source, lexer, style string) (err error)

Highlight and print the syntax of the source string except when piped to stdout.

func HighlightWriter

func HighlightWriter(w io.Writer, source, lexer, style string) (err error)

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

func NumberizeKeys(keys []string) string

NumberizeKeys uses ANSI to underline and prefix a sequential number in front of each key.

func Options

func Options(s string, opts []string, shorthand bool) (usage string)

Options appends options: ... to the usage string.

func Required

func Required(s string) (usage string)

Required appends (required) to the usage string.

func Term

func Term() (term string)

Term determines the terminal type based on the COLORTERM and TERM environment variables.

func UnderlineChar

func UnderlineChar(c string) (s string, err error)

UnderlineChar uses ANSI to underline the first character of a string.

func UnderlineKeys

func UnderlineKeys(keys []string) string

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL