ui

package
v0.47.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ui provides colored console output with a nautical theme. It wraps the structured logging package to provide a user-friendly CLI experience.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Colors for direct use in formatting.
	Red    = color.New(color.FgRed)
	Green  = color.New(color.FgGreen)
	Yellow = color.New(color.FgYellow)
	Blue   = color.New(color.FgBlue)
	Cyan   = color.New(color.FgCyan)
	Gray   = color.New(color.FgHiBlack)
	Bold   = color.New(color.Bold)
)

Functions

func Anchor

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

Anchor prints an anchor-themed message.

func Compass

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

Compass prints a compass-themed message.

func Debug added in v0.2.10

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

Debug prints a debug message (only visible when debug level is enabled). In console mode, prints in gray.

func Error

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

Error prints a red error message with X. In JSON mode, logs as error level.

func Fatal

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

Fatal prints an error to stderr and exits with code 1.

func Fatalf

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

Fatalf prints a formatted error and exits with code 1.

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

Header prints a bold header.

func Info

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

Info prints a blue info message. In JSON mode, logs as info level.

func Logger added in v0.2.10

func Logger() *zerolog.Logger

Logger returns a zerolog.Logger for structured logging with additional fields. Use this when you need to add structured fields to a log entry.

func Mayday

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

Mayday prints a mayday-themed error message.

func Package

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

Package prints a package-themed message.

func SetExitFn added in v0.30.0

func SetExitFn(fn func(int)) func(int)

SetExitFn replaces the exit function used by Fatal/Fatalf and returns the previous one. Intended for test use only — not goroutine-safe. Call from the test goroutine before exercising code that may call Fatal. Usage: `old := ui.SetExitFn(func(int) {}); t.Cleanup(func() { ui.SetExitFn(old) })`

func Ship

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

Ship prints a ship-themed message.

func Snapshot

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

Snapshot prints a snapshot-themed message.

func Step

func Step(n int, format string, args ...any)

Step prints a numbered step in cyan.

func Success

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

Success prints a green success message with checkmark. In JSON mode, logs as info level with success=true.

func Warning

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

Warning prints a yellow warning message. In JSON mode, logs as warn level.

func WithComponent added in v0.2.10

func WithComponent(component string) zerolog.Logger

WithComponent returns a logger with the component field set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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