ui

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ui contains small terminal-formatting helpers for the compiler CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clock

func Clock() string

Clock returns the timestamp format used by dev-server log lines.

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal reports whether f is a real terminal. A char-device stat check is not enough: /dev/null is a character device, and treating it as a TTY makes interactive prompts block forever in cron/CI environments.

func NewLineWriter

func NewLineWriter(dst io.Writer, fn func(line string) (string, bool)) io.WriteCloser

NewLineWriter returns a writer that buffers bytes into lines, applies fn to each complete line, and writes accepted lines to dst.

Types

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer applies ANSI styling when its stream supports color.

func New

func New(f *os.File) *Printer

New returns a printer for f. Styling is enabled only for terminal files when NO_COLOR is unset and TERM is not "dumb".

func (*Printer) Bold

func (p *Printer) Bold(s string) string

Bold returns s in bold when color is enabled.

func (*Printer) Cyan

func (p *Printer) Cyan(s string) string

Cyan returns s in cyan when color is enabled.

func (*Printer) Dim

func (p *Printer) Dim(s string) string

Dim returns s dimmed when color is enabled.

func (*Printer) Enabled

func (p *Printer) Enabled() bool

Enabled reports whether this printer emits ANSI escapes.

func (*Printer) Green

func (p *Printer) Green(s string) string

Green returns s in green when color is enabled.

func (*Printer) Magenta

func (p *Printer) Magenta(s string) string

Magenta returns s in magenta when color is enabled.

func (*Printer) Red

func (p *Printer) Red(s string) string

Red returns s in red when color is enabled.

func (*Printer) Yellow

func (p *Printer) Yellow(s string) string

Yellow returns s in yellow when color is enabled.

Jump to

Keyboard shortcuts

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