Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/tanishiking/jpp" ) func main() { jsonStr := ` [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ], [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ] ] ` res, _ := jpp.Pretty(jsonStr, " ", 20, nil) fmt.Println(res) // [ // [ // 1, 2, 3, 4, 5, // 6, 7, 8, 9, 10 // ], // [ // 1, 2, 3, 4, 5, // 6, 7, 8, 9, 10, // 11, 12, 13, 14, // 15 // ], // [ // 1, 2, 3, 4, 5, // 6, 7, 8, 9, 10, // 11, 12, 13, 14, // 15, 16, 17, 18, // 19, 20 // ] // ] }
Output:
Index ¶
- Variables
- func Black(format string, args ...interface{}) string
- func Blue(format string, args ...interface{}) string
- func BoldBlack(format string, args ...interface{}) string
- func BoldBlue(format string, args ...interface{}) string
- func BoldBrown(format string, args ...interface{}) string
- func BoldCyan(format string, args ...interface{}) string
- func BoldGray(format string, args ...interface{}) string
- func BoldGreen(format string, args ...interface{}) string
- func BoldMagenta(format string, args ...interface{}) string
- func BoldRed(format string, args ...interface{}) string
- func Brown(format string, args ...interface{}) string
- func Cyan(format string, args ...interface{}) string
- func Gray(format string, args ...interface{}) string
- func Green(format string, args ...interface{}) string
- func Magenta(format string, args ...interface{}) string
- func NoColor(format string, args ...interface{}) string
- func Pretty(jsonStr string, i string, w int, colorScheme *ColorScheme) (string, error)
- func Red(format string, args ...interface{}) string
- type ColorScheme
- type ColoredFormat
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultScheme is plain color scheme that doesn't specify // any colors or SGRs. // Note that the default color scheme for CLI tool is not this. DefaultScheme = &ColorScheme{ Null: NoColor, Bool: NoColor, Number: NoColor, String: NoColor, FieldName: NoColor, } )
Functions ¶
func Black ¶
Black formats according to a format specifier and returns the resulting string colored by black.
func Blue ¶
Blue formats according to a format specifier and returns the resulting string colored by blue.
func BoldBlack ¶
BoldBlack formats according to a format specifier and returns the resulting bold string colored by black.
func BoldBlue ¶
BoldBlue formats according to a format specifier and returns the resulting bold string colored by blue.
func BoldBrown ¶
BoldBrown formats according to a format specifier and returns the resulting bold string colored by brown.
func BoldCyan ¶
BoldCyan formats according to a format specifier and returns the resulting bold string colored by cyan.
func BoldGray ¶
BoldGray formats according to a format specifier and returns the resulting bold string colored by gray.
func BoldGreen ¶
BoldGreen formats according to a format specifier and returns the resulting bold string colored by green.
func BoldMagenta ¶
BoldMagenta formats according to a format specifier and returns the resulting bold string colored by magenta.
func BoldRed ¶
BoldRed formats according to a format specifier and returns the resulting bold string colored by red.
func Brown ¶
Brown formats according to a format specifier and returns the resulting string colored by brown.
func Cyan ¶
Cyan formats according to a format specifier and returns the resulting string colored by cyan.
func Gray ¶
Gray formats according to a format specifier and returns the resulting string colored by gray.
func Green ¶
Green formats according to a format specifier and returns the resulting string colored by green.
func Magenta ¶
Magenta formats according to a format specifier and returns the resulting string colored by magenta.
Types ¶
type ColorScheme ¶
type ColorScheme struct { Null ColoredFormat Bool ColoredFormat Number ColoredFormat String ColoredFormat FieldName ColoredFormat }
ColorScheme is used for specifying the output color or SGR using https://github.com/fatih/color
type ColoredFormat ¶
ColoredFormat formats according to a format specifier and returns the resulting string.