Help us shape the future of Go! Take the 2026 Go Developer Survey

console

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package console provides shared presentation for human-readable CLI output.

Index

Constants

View Source
const (
	Bold   = "1;34"
	Cyan   = "36"
	Green  = "32"
	Yellow = "33"
	Red    = "31"
	Dim    = "2"
)

Variables

This section is empty.

Functions

func FlagSet

func FlagSet(name string) *flag.FlagSet

func SyncSummary

func SyncSummary(out io.Writer, repositories, alerts int, org, duration string) error

Types

type Palette

type Palette struct{ Enabled bool }

func New

func New() Palette

NO_COLOR presence disables color, including an explicitly empty value. JSON callers bypass this package so machine-readable output stays unchanged.

func (Palette) Color

func (p Palette) Color(code, value string) string

func (Palette) Label

func (p Palette) Label(value string) string

func (Palette) Priority

func (p Palette) Priority(value string) string

type Progress

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

Progress shows counted work when a total is known, or activity and downloaded item counts when GitHub pagination has not yet revealed a total.

func NewProgress

func NewProgress(out io.Writer) *Progress

func (*Progress) Finish

func (p *Progress) Finish(err error) error

Finish stops animation and leaves a complete line even on failure/cancellation. It must be called exactly once after all progress producers have returned.

func (*Progress) Update

func (p *Progress) Update(phase string, done, total int)

Update uses total=-1 for unknown totals. Known empty phases use total=0.

type Writer

type Writer struct {
	Out     io.Writer
	Palette Palette
	Code    string
}

Writer colors flag help and parsing diagnostics without changing their text.

func (Writer) Write

func (w Writer) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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