Documentation
¶
Index ¶
- Variables
- func Base64(s string) []byte
- func Circular(path ...interface{}) interface{}
- func ColorStr(c Color, s string) string
- func Duration(s string) time.Duration
- func F(v interface{}) string
- func Format(ts []*Token, theme func(Type) Color) string
- func GetPrivateField(v reflect.Value, i int) reflect.Value
- func P(values ...interface{}) error
- func Plain(v interface{}) string
- func Ptr(v interface{}) interface{}
- func StripColor(str string) string
- func Time(s string) time.Time
- type Color
- type Token
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTheme = func(t Type) Color { switch t { case TypeName: return Cyan case Bool: return Blue case Rune, Byte, String: return Yellow case Number: return Green case Chan, Func, UnsafePointer: return Magenta case Comment: return White case PointerCircular: return Red default: return None } }
DefaultTheme colors for Sprint
View Source
var NoTheme = func(t Type) Color { return None }
NoTheme colors for Sprint
View Source
var Stdout io.Writer = os.Stdout
Stdout is the default stdout for gop.P .
View Source
var SupportsColor = func() bool { b, _ := exec.Command("tput", "colors").CombinedOutput() n, _ := strconv.ParseInt(strings.TrimSpace(string(b)), 10, 32) return n > 0 }()
SupportsColor returns true if current shell supports ANSI color
Functions ¶
func Circular ¶ added in v0.17.0
func Circular(path ...interface{}) interface{}
Circular reference of the path from the root
func GetPrivateField ¶
GetPrivateField field value via field index TODO: we can use a LRU cache for the copy of the values, but it might be trivial for just testing.
func StripColor ¶ added in v0.15.2
StripColor is copied from https://github.com/acarl005/stripansi
Types ¶
type Type ¶
type Type int
Type of token
const ( // Nil type Nil Type = iota // Bool type Bool // Number type Number // Float type Float // Complex type Complex // String type String // Byte type Byte // Rune type Rune // Chan type Chan // Func type Func // UnsafePointer type UnsafePointer // Comment type Comment // TypeName type TypeName // ParenOpen type ParenOpen // ParenClose type ParenClose // PointerOpen type PointerOpen // PointerClose type PointerClose // PointerCircular type PointerCircular // SliceOpen type SliceOpen // SliceItem type SliceItem // InlineComma type InlineComma // Comma type Comma // SliceClose type SliceClose // MapOpen type MapOpen // MapKey type MapKey // Colon type Colon // MapClose type MapClose // StructOpen type StructOpen // StructKey type StructKey // StructField type StructField // StructClose type StructClose )
Click to show internal directories.
Click to hide internal directories.