printer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package printer provides formatted terminal output for Stackup operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Printer

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

Printer writes structured, human-readable output to a writer.

func New

func New(w io.Writer) *Printer

New creates a Printer that writes to w with auto-detected TTY color support.

func (*Printer) Bold

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

Bold returns text in bold (or plain if no TTY).

func (*Printer) CleanupSuggestion

func (p *Printer) CleanupSuggestion(runningSvcs []string)

CleanupSuggestion advises the user to run stackup down.

func (*Printer) ClearScreen

func (p *Printer) ClearScreen()

ClearScreen sends ANSI escape sequences to move cursor home and clear the screen. No-op when output is not a TTY.

func (*Printer) Dim

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

Dim returns text in dim gray (or plain if no TTY).

func (*Printer) EnvDefault

func (p *Printer) EnvDefault(key, val string)

EnvDefault reports a schema default was injected for a missing key.

func (*Printer) EnvKeyValid

func (p *Printer) EnvKeyValid(key, typ string)

EnvKeyValid reports a single env key passed type validation.

func (*Printer) EnvValid

func (p *Printer) EnvValid(keyCount int)

EnvValid reports that environment validation passed.

func (*Printer) Green

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

Green returns text colored green (or plain if no TTY).

func (*Printer) Hint

func (p *Printer) Hint(lines ...string)

Hint prints actionable suggestions for the user.

func (*Printer) IsTTY

func (p *Printer) IsTTY() bool

IsTTY returns whether the output is an interactive terminal.

func (*Printer) Phase

func (p *Printer) Phase(name string)

Phase prints a section header for the current operation.

func (*Printer) Ready

func (p *Printer) Ready(total time.Duration)

Ready reports the stack is fully healthy with the total startup duration.

func (*Printer) Red

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

Red returns text colored red (or plain if no TTY).

func (*Printer) ServiceFailed

func (p *Printer) ServiceFailed(name string, err error)

ServiceFailed reports a service health check failure.

func (*Printer) ServiceHealthy

func (p *Printer) ServiceHealthy(name, checkType string, duration time.Duration)

ServiceHealthy reports a service passed its health check.

func (*Printer) ServiceLogs

func (p *Printer) ServiceLogs(name string, logs string)

ServiceLogs prints the tail of a service's container logs.

func (*Printer) ServiceWaiting

func (p *Printer) ServiceWaiting(name string, elapsed time.Duration)

ServiceWaiting reports a service is still being checked.

func (*Printer) SummaryTable

func (p *Printer) SummaryTable(results []ServiceResult, total time.Duration)

SummaryTable prints a bordered table of service health check results.

func (*Printer) ValidationError

func (p *Printer) ValidationError(key, message string)

ValidationError reports an env validation failure.

func (*Printer) Writer

func (p *Printer) Writer() io.Writer

Writer returns the underlying io.Writer.

func (*Printer) Yellow

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

Yellow returns text colored yellow (or plain if no TTY).

type ServiceResult

type ServiceResult struct {
	Name    string
	Label   string
	Elapsed time.Duration
	Err     error
}

ServiceResult records the outcome of a health check for summary display.

type Spinner

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

Spinner provides an animated progress indicator for long-running operations.

func NewSpinner

func NewSpinner(w io.Writer, isTTY bool) *Spinner

NewSpinner creates a spinner that writes to the given writer.

func (*Spinner) Start

func (s *Spinner) Start(message string)

Start begins the spinner animation with the given message.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the spinner animation.

Jump to

Keyboard shortcuts

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