ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ui provides output formatting primitives: progress spinners, tables, JSON output, and human-readable formatting helpers. It centralises all terminal rendering so slice packages do not import rendering libraries directly.

This is a shared kernel package. It must contain no business logic. Slice packages under internal/ may import it freely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w io.Writer, v any) error

JSON writes v as indented JSON to w.

func Step

func Step(msg string)

Step prints a progress step to stderr.

func Success

func Success(format string, args ...any)

Success prints a success message to stderr.

func Table

func Table(w io.Writer, headers []string, rows [][]string)

Table renders rows as an aligned table with a header and separator.

func Warn

func Warn(format string, args ...any)

Warn prints a warning to stderr.

Types

type Format

type Format string

Format controls how command output is rendered.

const (
	// FormatHuman renders output as human-readable text.
	FormatHuman Format = "human"
	// FormatJSON renders output as JSON.
	FormatJSON Format = "json"
)

func ParseFormat

func ParseFormat(s string) Format

ParseFormat converts a string to a Format, defaulting to FormatHuman.

type Spinner

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

Spinner provides simple braille-spinner progress indication on stderr.

func Start

func Start(msg string) *Spinner

Start creates and begins a spinner with the given message.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the spinner and clears its line.

Jump to

Keyboard shortcuts

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