ui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ui renders everything the CLI prints. On a terminal it is styled; piped, redirected, or with NO_COLOR it degrades to plain text that greps and logs cleanly, because the start command's child writes to a log file.

One truecolor accent marks identity (the title, the panel edge) and degrades with the terminal. Status rides the named ANSI colors, so the user's theme decides how red and green look, and every colored state also carries a symbol or a number, so nothing is lost when color is. Secondary text uses bright black, which themes define against their own background, rather than the dim attribute.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Banner struct {
	Version string
	Fields  []Field
	URLs    []string
}

Banner is the startup summary for the run command.

type Field

type Field struct {
	Key, Value, Note string
}

Field is one labelled line in a block.

type UI

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

UI writes to one stream.

func New

func New(w io.Writer) *UI

New wraps w. Styling turns on only when w is a terminal that takes color.

func (*UI) Error

func (u *UI) Error(err error)

Error prints a failure. The first line is the headline; further lines are the fix, shown dimmed beneath it.

func (*UI) Fields

func (u *UI) Fields(fields []Field)

Fields prints labelled lines, for status and config output.

func (*UI) Info

func (u *UI) Info(msg string)

Info prints a neutral state line.

func (*UI) Request

func (u *UI) Request(at time.Time, method, path string, status int, took time.Duration)

Request prints one access-log line.

func (*UI) Startup

func (u *UI) Startup(b Banner)

Startup prints the banner: a rounded panel on a terminal, key: value lines otherwise.

func (*UI) Success

func (u *UI) Success(msg string)

Success prints a completed action.

func (*UI) Warn

func (u *UI) Warn(msg string)

Warn prints something the user should look at.

Jump to

Keyboard shortcuts

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