printer

package
v0.0.0-...-01c0eb4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorBlack int = iota + 30
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
)

Variables

This section is empty.

Functions

func Color

func Color(s string, c int) string

Types

type JSONPrinter

type JSONPrinter struct {
	// contains filtered or unexported fields
}

JSONPrinter is a StringPrinter which supports indentation and syntax highlighting for printing JSON to a terminal window using ANSI codes to define the syntax colours.

func NewJSONPrinter

func NewJSONPrinter() *JSONPrinter

NewJSONPrinter returns the default instance of JSONPrinter with a default indentation setting of 2 spaces.

func (*JSONPrinter) PrintString

func (jp *JSONPrinter) PrintString(w io.Writer, a string)

PrintString prints a JSON string to an io.Writer, after scanning and syntax highlighting via ANSI codes has taken place.

type StringPrinter

type StringPrinter interface {
	PrintString(w io.Writer, a string)
}

StringPrinter defines the behaviour of an object which must be able to 'PrintString', by a passed string, through to an instance of io.Writer.

Jump to

Keyboard shortcuts

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