output

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const ANSI_BLACK int = 30
View Source
const ANSI_BLUE int = 34
View Source
const ANSI_BLUE_L int = 94
View Source
const ANSI_GREEN int = 32
View Source
const ANSI_GREEN_L int = 92
View Source
const ANSI_RED int = 31
View Source
const ANSI_RED_L int = 91
View Source
const ANSI_WHITE int = 47
View Source
const ANSI_YELLOW int = 33
View Source
const ANSI_YELLOW_L int = 93
View Source
const ESCAPE_CODE string = "\x1B"
View Source
const FAIL_CHR string = "-"
View Source
const INFO_CHR string = "i"
View Source
const NEWLINE string = "\n"
View Source
const SUCCESS_CHR string = "+"
View Source
const SYS_CHR string = "*"
View Source
const VTP bool = true
View Source
const WARNING_CHR string = "!"

Variables

View Source
var ANSI_RESET string = fmt.Sprintf("%s0m", CSI)

control sequence used to reset the output settings to the original values.

View Source
var BLUE_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_BLUE_L)
View Source
var BLUE_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_BLUE)
View Source
var CLEAR_LINE string = fmt.Sprintf("\r%s2K\r", CSI)

control sequence used to clear the entirty of the current line

View Source
var CLEAR_SCREEN string = fmt.Sprintf("%s2J%sH", CSI, CSI)

control sequence used to clear the entire screen and move the cursor to (0,0).

control sequence introducer shorthand (aka: "\x1B["")

View Source
var FAIL_SEQ string = fmt.Sprintf("%s[%s]%s", RED_L_SEQ, FAIL_CHR, ANSI_RESET)
View Source
var GREEN_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_GREEN_L)
View Source
var GREEN_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_GREEN)
View Source
var INDENT_SEQ string = fmt.Sprintf("%s%%dC", CSI)

escape sequence used to indent n number of spaces "\x1b[%dC"

View Source
var INFO_SEQ string = fmt.Sprintf("%s[%s]%s", BLUE_L_SEQ, INFO_CHR, ANSI_RESET)
View Source
var RED_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_RED_L)
View Source
var RED_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_RED)
View Source
var SUCCESS_SEQ string = fmt.Sprintf("%s[%s]%s", GREEN_L_SEQ, SUCCESS_CHR, ANSI_RESET)
View Source
var WARNING_SEQ string = fmt.Sprintf("%s[%s]%s", YELLOW_L_SEQ, WARNING_CHR, ANSI_RESET)
View Source
var YELLOW_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_YELLOW_L)
View Source
var YELLOW_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_YELLOW)

Functions

This section is empty.

Types

type Formatter added in v0.0.12

type Formatter struct{}

object designed to format output using ANSI colors. similar to Outputter.

func NewFormatter added in v0.0.12

func NewFormatter() (obj *Formatter, err error)

function designed to create and return a new formatter object that can be used later on.

func (*Formatter) BlueText added in v0.0.12

func (f *Formatter) BlueText(text interface{}) (formatted string)

function designed to take an input and return a Blue colored string containing the given text.

func (*Formatter) CenterString added in v0.0.14

func (f *Formatter) CenterString(msg interface{}, n int) (formatted string)

function designed to print a string in the center of a line with a given length "n".

currently, this includes non-printable characters in the length calculation.

func (*Formatter) ErrMsg added in v0.0.13

func (f *Formatter) ErrMsg(text interface{}) (formatted string)

function designed to take an input and return a formatted Success string. this string output will be formatted the same as an Outputter's ErrMsg.

func (*Formatter) GreenText added in v0.0.12

func (f *Formatter) GreenText(text interface{}) (formatted string)

function designed to take an input and return a Green colored string containing the given text.

func (*Formatter) InfMsg added in v0.0.13

func (f *Formatter) InfMsg(text interface{}) (formatted string)

function designed to take an input and return a formatted Success string. this string output will be formatted the same as an Outputter's InfMsg.

func (*Formatter) PrintChar added in v0.0.14

func (f *Formatter) PrintChar(char byte, n int) (outline string)

function designed to print a given char "c", "n" number of times.

func (*Formatter) RedText added in v0.0.12

func (f *Formatter) RedText(text interface{}) (formatted string)

function designed to take an input and return a Red colored string containing the given text.

func (*Formatter) SucMsg added in v0.0.13

func (f *Formatter) SucMsg(text interface{}) (formatted string)

function designed to take an input and return a formatted Success string. this string output will be formatted the same as an Outputter's SucMsg.

func (*Formatter) SysMsg added in v0.0.13

func (f *Formatter) SysMsg(text interface{}) (formatted string)

function designed to take an input and return a formatted Success string. this string output will be formatted the same as an Outputter's SysMsg.

func (*Formatter) YellowText added in v0.0.12

func (f *Formatter) YellowText(text interface{}) (formatted string)

function designed to take an input and return a Yellow colored string containing the given text.

type Outputter

type Outputter struct {
	// built-in mutext used to avoid collisions when outputting
	// data using threading.
	Mutex *sync.Mutex
}

object designed to output formatted strings uising ANSI colors.

func NewOutputter

func NewOutputter() (obj *Outputter, err error)

function designed to create and return a new outputter object that can be used later on.

func (*Outputter) CenterString added in v0.0.13

func (o *Outputter) CenterString(msg interface{}, n int)

function designed to print a string in the center of a line with a given length "n".

currently, this includes non-printable characters in the length calculation.

func (*Outputter) ErrMsg

func (o *Outputter) ErrMsg(message interface{})

function designed to print an error message with the format: [-] <message>

func (*Outputter) InfMsg

func (o *Outputter) InfMsg(message interface{})

function designed to print an info message with the format: [i] <message>

func (*Outputter) InfMsgNB

func (o *Outputter) InfMsgNB(message interface{})

function designed to print an info message with the format: [i] <message>

note: this does not add a newline character to the end.

func (*Outputter) PrintBlue added in v0.0.11

func (o *Outputter) PrintBlue(message interface{})

function designed to print the given message in Blue. a newline will be appended to the message upon printing.

func (*Outputter) PrintChar added in v0.0.13

func (o *Outputter) PrintChar(char byte, n int)

function designed to print a given char "c", "n" number of times. this appends a newline character to the end of the sequence.

func (*Outputter) PrintGreen added in v0.0.11

func (o *Outputter) PrintGreen(message interface{})

function designed to print the given message in Green. a newline will be appended to the message upon printing.

func (*Outputter) PrintRed added in v0.0.11

func (o *Outputter) PrintRed(message interface{})

function designed to print the given message in Red. a newline will be appended to the message upon printing.

func (*Outputter) PrintYellow added in v0.0.11

func (o *Outputter) PrintYellow(message interface{})

function designed to print the given message in Yellow. a newline will be appended to the message upon printing.

func (*Outputter) SucMsg

func (o *Outputter) SucMsg(message interface{})

function designed to print a success message with the format: [+] <message>

func (*Outputter) SysMsg

func (o *Outputter) SysMsg(message interface{})

function designed to print a system message with the format: [*] <message>

func (*Outputter) SysMsgNB

func (o *Outputter) SysMsgNB(message interface{})

function designed to print a system message with the format: [*] <message>

note: this does not add a newline character to the end.

func (*Outputter) WrnMsg

func (o *Outputter) WrnMsg(message interface{})

function designed to print a warning message with the format: [!] <message>

Jump to

Keyboard shortcuts

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