line_printer

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 NewCustom

func NewCustom(out io.Writer, smartTerminal, supportsColor bool) *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

type LineType

type LineType int
const (
	Full LineType = iota
	Elide
)

Jump to

Keyboard shortcuts

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