Documentation ¶
Index ¶
- Constants
- Variables
- type Formatter
- func (f *Formatter) BlueText(text interface{}) (formatted string)
- func (f *Formatter) CenterString(msg interface{}, n int) (formatted string)
- func (f *Formatter) ErrMsg(text interface{}) (formatted string)
- func (f *Formatter) GreenText(text interface{}) (formatted string)
- func (f *Formatter) InfMsg(text interface{}) (formatted string)
- func (f *Formatter) PrintChar(char byte, n int) (outline string)
- func (f *Formatter) RedText(text interface{}) (formatted string)
- func (f *Formatter) SucMsg(text interface{}) (formatted string)
- func (f *Formatter) SysMsg(text interface{}) (formatted string)
- func (f *Formatter) YellowText(text interface{}) (formatted string)
- type Outputter
- func (o *Outputter) CenterString(msg interface{}, n int)
- func (o *Outputter) ErrMsg(message interface{})
- func (o *Outputter) InfMsg(message interface{})
- func (o *Outputter) InfMsgNB(message interface{})
- func (o *Outputter) PrintBlue(message interface{})
- func (o *Outputter) PrintChar(char byte, n int)
- func (o *Outputter) PrintGreen(message interface{})
- func (o *Outputter) PrintRed(message interface{})
- func (o *Outputter) PrintYellow(message interface{})
- func (o *Outputter) SucMsg(message interface{})
- func (o *Outputter) SysMsg(message interface{})
- func (o *Outputter) SysMsgNB(message interface{})
- func (o *Outputter) WrnMsg(message interface{})
Constants ¶
const ANSI_BLACK int = 30
const ANSI_BLUE int = 34
const ANSI_BLUE_L int = 94
const ANSI_GREEN int = 32
const ANSI_GREEN_L int = 92
const ANSI_RED int = 31
const ANSI_RED_L int = 91
const ANSI_WHITE int = 47
const ANSI_YELLOW int = 33
const ANSI_YELLOW_L int = 93
const ESCAPE_CODE string = "\x1B"
const FAIL_CHR string = "-"
const INFO_CHR string = "i"
const SUCCESS_CHR string = "+"
const SYS_CHR string = "*"
const WARNING_CHR string = "!"
Variables ¶
var ANSI_RESET string = fmt.Sprintf("%s0m", CSI)
control sequence used to reset the output settings to the original values.
var BLUE_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_BLUE_L)
var CLEAR_LINE string = fmt.Sprintf("\r%s2K\r", CSI)
control sequence used to clear the entirty of the current line
control sequence used to clear the entire screen and move the cursor to (0,0).
var CSI string = fmt.Sprintf("%s[", ESCAPE_CODE)
control sequence introducer shorthand (aka: "\x1B["")
var FAIL_SEQ string = fmt.Sprintf("%s[%s]%s", RED_L_SEQ, FAIL_CHR, ANSI_RESET)
var GREEN_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_GREEN_L)
var GREEN_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_GREEN)
var INDENT_SEQ string = fmt.Sprintf("%s%%dC", CSI)
escape sequence used to indent n number of spaces "\x1b[%dC"
var INFO_SEQ string = fmt.Sprintf("%s[%s]%s", BLUE_L_SEQ, INFO_CHR, ANSI_RESET)
var RED_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_RED_L)
var SUCCESS_SEQ string = fmt.Sprintf("%s[%s]%s", GREEN_L_SEQ, SUCCESS_CHR, ANSI_RESET)
var SYS_SEQ string = fmt.Sprintf("%s[%s]%s", YELLOW_L_SEQ, SYS_CHR, ANSI_RESET)
var WARNING_SEQ string = fmt.Sprintf("%s[%s]%s", YELLOW_L_SEQ, WARNING_CHR, ANSI_RESET)
var YELLOW_L_SEQ string = fmt.Sprintf("%s%d;1m", CSI, ANSI_YELLOW_L)
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
function designed to create and return a new formatter object that can be used later on.
func (*Formatter) BlueText ¶ added in v0.0.12
function designed to take an input and return a Blue colored string containing the given text.
func (*Formatter) CenterString ¶ added in v0.0.14
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
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
function designed to take an input and return a Green colored string containing the given text.
func (*Formatter) InfMsg ¶ added in v0.0.13
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
function designed to print a given char "c", "n" number of times.
func (*Formatter) RedText ¶ added in v0.0.12
function designed to take an input and return a Red colored string containing the given text.
func (*Formatter) SucMsg ¶ added in v0.0.13
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
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
function designed to take an input and return a Yellow colored string containing the given text.
type Outputter ¶
type Outputter struct{}
object designed to output formatted strings uising ANSI colors.
func NewOutputter ¶
function designed to create and return a new outputter object that can be used later on.
func (*Outputter) CenterString ¶ added in v0.0.13
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
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>