Documentation
¶
Index ¶
- func SmartTerminal() bool
- func SupportsColor() bool
- type LinePrinter
- func (p *LinePrinter) Esc(codes ...int) string
- func (p *LinePrinter) Print(toPrint string, lineType LineType)
- func (p *LinePrinter) PrintOnNewline(toPrint string)
- func (p *LinePrinter) SetConsoleLocked(locked bool)
- func (p *LinePrinter) SmartTerminal() bool
- func (p *LinePrinter) SupportsColor() bool
- type LineType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SmartTerminal ¶
func SmartTerminal() bool
func SupportsColor ¶
func SupportsColor() bool
Types ¶
type LinePrinter ¶
type LinePrinter struct {
// contains filtered or unexported fields
}
TODO(tylerw): this is probably pretty alloc heavy because of string use. Profile and fix.
func New ¶
func New() *LinePrinter
func (*LinePrinter) Esc ¶
func (p *LinePrinter) Esc(codes ...int) string
Esc returns an ANSI escape sequence for the given codes. If either stdout or stderr is not a tty, it returns an empty string. It is intended only for text styling, where dropping the escape sequence still produces usable text content.
Example:
terminal.Esc(1, 31) + "Bold red text" + terminal.Esc() + " normal text"
func (*LinePrinter) Print ¶
func (p *LinePrinter) Print(toPrint string, lineType LineType)
func (*LinePrinter) PrintOnNewline ¶
func (p *LinePrinter) PrintOnNewline(toPrint string)
func (*LinePrinter) SetConsoleLocked ¶
func (p *LinePrinter) SetConsoleLocked(locked bool)
func (*LinePrinter) SmartTerminal ¶
func (p *LinePrinter) SmartTerminal() bool
func (*LinePrinter) SupportsColor ¶
func (p *LinePrinter) SupportsColor() bool
Click to show internal directories.
Click to hide internal directories.