pringo

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 3 Imported by: 11

README

pringo

Go module for easier printing to console

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color string

Font Colors

const (
	Black   Color = "\u001b[30m"
	Red     Color = "\u001b[31m"
	Green   Color = "\u001b[32m"
	Yellow  Color = "\u001b[33m"
	Blue    Color = "\u001b[34m"
	Magenta Color = "\u001b[35m"
	Cyan    Color = "\u001b[36m"
	White   Color = "\u001b[37m"
	None    Color = ""
)
const (
	BlackBright   Color = "\u001b[30;1m"
	RedBright     Color = "\u001b[31;1m"
	GreenBright   Color = "\u001b[32;1m"
	YellowBright  Color = "\u001b[33;1m"
	BlueBright    Color = "\u001b[34;1m"
	MagentaBright Color = "\u001b[35;1m"
	CyanBright    Color = "\u001b[36;1m"
	WhiteBright   Color = "\u001b[37;1m"
)

Font Colors Bright

const (
	BackgroundBlack   Color = "\u001b[40m"
	BackgroundRed     Color = "\u001b[41m"
	BackgroundGreen   Color = "\u001b[42m"
	BackgroundYellow  Color = "\u001b[43m"
	BackgroundBlue    Color = "\u001b[44m"
	BackgroundMagenta Color = "\u001b[45m"
	BackgroundCyan    Color = "\u001b[46m"
	BackgroundWhite   Color = "\u001b[47m"
)

Background Colors

const (
	BackgroundBlackBright   Color = "\u001b[40;1m"
	BackgroundRedBright     Color = "\u001b[41;1m"
	BackgroundGreenBright   Color = "\u001b[42;1m"
	BackgroundYellowBright  Color = "\u001b[43;1m"
	BackgroundBlueBright    Color = "\u001b[44;1m"
	BackgroundMagentaBright Color = "\u001b[45;1m"
	BackgroundCyanBright    Color = "\u001b[46;1m"
	BackgroundWhiteBright   Color = "\u001b[47;1m"
)

Background Colors Bright

type Printer

type Printer struct {
	Stdin  *os.File
	Stdout *os.File
	Stderr *os.File
	// contains filtered or unexported fields
}

func New

func New(stdout *os.File, stderr *os.File, stdin *os.File) *Printer

Creates a new Printer instance with set stdin, stdout and stderr.

func NewDefault

func NewDefault() *Printer

The same as New() but with os.Stdout, os.Stderr and os.Stdin as default.

func (*Printer) Err

func (p *Printer) Err(s string)

Prints to stderr but without newline and color.

func (*Printer) Errf

func (p *Printer) Errf(format string, args ...interface{})

Prints to stderr as a format string but without color.

func (*Printer) Errln

func (p *Printer) Errln(s string)

Prints to stderr with newline but without color.

func (*Printer) Error

func (p *Printer) Error(s string, c Color)

Prints to stderr with color but without a newline.

func (*Printer) Errorf

func (p *Printer) Errorf(format string, c Color, args ...interface{})

Errorf is the same as Error() but with a format string.

func (*Printer) Errorln

func (p *Printer) Errorln(s string, c Color)

Errorln is the same as Error() but with a newline at the end.

func (*Printer) Print

func (p *Printer) Print(s string, c Color)

Prints to stdout with color but without a newline.

func (*Printer) Printf

func (p *Printer) Printf(format string, c Color, args ...interface{})

Printf is the same as Print() but with a format string.

func (*Printer) Println

func (p *Printer) Println(s string, c Color)

Println is the same as Print() but with a newline at the end.

func (*Printer) Promt

func (p *Printer) Promt(s string, c Color) string

Promts the user in the same line and returns the input.

func (*Printer) Promtf

func (p *Printer) Promtf(s string, c Color, args ...interface{}) string

The same as Promt() but as a template string.

func (*Printer) Promtln

func (p *Printer) Promtln(s string, c Color) string

The same as Promt() but with newline.

func (*Printer) Read

func (p *Printer) Read() string

Directly reads from the command line.

func (*Printer) Write

func (p *Printer) Write(s string)

Prints to stdout but without newline and color.

func (*Printer) Writef

func (p *Printer) Writef(format string, args ...interface{})

Prints to stdout as a format string but without color.

func (*Printer) Writeln

func (p *Printer) Writeln(s string)

Prints to stdout with newline but without color.

Jump to

Keyboard shortcuts

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