ui

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ui carries the CLI's output conventions, matching the bash implementation's verbose.sh helpers byte for byte so ported commands stay indistinguishable from their argsh originals.

Index

Constants

This section is empty.

Variables

View Source
var ErrHandled = errors.New("handled")

ErrHandled marks an error whose message was already printed in the bash implementation's own format ([error] … on stderr). It is the ONE sentinel: every package's name for it (cli.ErrHandled, kubehz.ErrHandled, secrets.ErrHandled, …) is this value, so errors.Is holds across package boundaries and a %w wrap anywhere still reads as handled. The caller exits non-zero without printing anything further.

Functions

func Debug

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

Debug writes a [debug] line to stderr when DEBUG is set (bash: debug()).

func DebugTo

func DebugTo(w io.Writer, format string, a ...any)

DebugTo writes a [debug] line to w when DEBUG is set.

func Error

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

Error writes an [error] line to stderr (bash: error()).

func ErrorTo

func ErrorTo(w io.Writer, format string, a ...any)

ErrorTo writes an [error] line to w.

func Handled

func Handled(err error) error

Handled marks err as already printed: the returned error reads as ErrHandled to errors.Is, keeps err's text, and unwraps to err so any sentinel or type inside it still matches. A site that prints its own [error] line and then returns an error wraps it here, and the exit mapping at the top (cli dispatchExit) prints nothing more. An error that reaches the top WITHOUT this mark was never printed, so the mapping prints it. nil stays nil.

func Warn

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

Warn writes a [warn] line to stderr (bash: warn()).

func WarnTo

func WarnTo(w io.Writer, format string, a ...any)

WarnTo writes a [warn] line to w.

Types

This section is empty.

Jump to

Keyboard shortcuts

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