output

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorCodes = map[string]map[string]string{
	"green": {
		"code":   "\x1b[32m",
		"quoted": "\"\\e[32m\"",
	},
	"red": {
		"code":   "\x1b[31m",
		"quoted": "\"\\e[31m\"",
	},
	"yellow": {
		"code":   "\x1b[33m",
		"quoted": "\"\\e[33m\"",
	},
	"stop": {
		"code":   "\x1b[0m",
		"quoted": "\"\\e[0m\"",
	},
}

Functions

func EscapeSingleQuotes added in v1.0.11

func EscapeSingleQuotes(s string) string

Types

type PlainPrint added in v1.0.11

type PlainPrint struct {
}

func NewPlainPrint added in v1.0.11

func NewPlainPrint() *PlainPrint

func (*PlainPrint) Cprintf added in v1.0.11

func (p *PlainPrint) Cprintf(color string, format string, args ...interface{}) (n int, err error)

func (*PlainPrint) DebugMessage added in v1.0.11

func (p *PlainPrint) DebugMessage(message, comment string)

func (*PlainPrint) Error added in v1.0.11

func (p *PlainPrint) Error(err error)

func (*PlainPrint) Message added in v1.0.11

func (p *PlainPrint) Message(message, color, comment string)

type Printer

type Printer interface {
	Cprintf(color string, format string, args ...interface{}) (n int, err error)
	Error(err error)
	DebugMessage(message, comment string)
	Message(message, color, comment string)
}

type Script

type Script struct {
	Printer *ScriptPrint
}

func NewScript

func NewScript() *Script

func (*Script) PrintBinaryAliasFunction

func (s *Script) PrintBinaryAliasFunction(name, path string) error

PrintBinaryAliasFunction prints a shell script with alias function TODO Add script block to prevent from loading not in bash/zsh shells (as in rvm script)

type ScriptPrint

type ScriptPrint struct {
}

func NewScriptPrint

func NewScriptPrint() *ScriptPrint

func (*ScriptPrint) CommentPrintf

func (s *ScriptPrint) CommentPrintf(format string, args ...interface{}) (n int, err error)

func (*ScriptPrint) Cprintf

func (s *ScriptPrint) Cprintf(color string, format string, args ...interface{}) (n int, err error)

func (*ScriptPrint) DebugMessage

func (s *ScriptPrint) DebugMessage(msg string, comment string)

DebugMessage output a message in gray color

func (*ScriptPrint) Error

func (s *ScriptPrint) Error(err error)

func (*ScriptPrint) Message

func (s *ScriptPrint) Message(msg string, color string, comment string)

Message output comment and message in script form: # comment echo -e color_code message stop_color_code

type SimplePrint

type SimplePrint struct {
}

func NewSimplePrint

func NewSimplePrint() *SimplePrint

func (*SimplePrint) Cprintf

func (p *SimplePrint) Cprintf(color string, format string, args ...interface{}) (n int, err error)

func (*SimplePrint) DebugMessage

func (p *SimplePrint) DebugMessage(message, comment string)

func (*SimplePrint) Error

func (p *SimplePrint) Error(err error)

func (*SimplePrint) Message

func (p *SimplePrint) Message(message, color, comment string)

Jump to

Keyboard shortcuts

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