output

package
v0.1.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(msg string, args ...interface{})

Error prints an error message to stderr.

func Info

func Info(msg string, args ...interface{})

Info prints an informational message.

func JSON

func JSON(data interface{})

JSON prints data as indented JSON.

func Print

func Print(data interface{}, humanFn func())

Print renders data based on the current format. humanFn is called for text format; data is used for JSON format.

func Quiet

func Quiet(val string)

Quiet always prints the given value, used for essential output in all modes.

func Raw added in v0.1.7

func Raw(s string)

Raw prints a literal string to stdout without any formatting, prefixes, or % interpretation. Used for dumping file contents and other bytes-in-bytes-out payloads. Suppressed in quiet mode so callers can emit only the minimal summary in that format.

func SetFormat

func SetFormat(f Format)

SetFormat sets the global output format.

func Success

func Success(msg string, args ...interface{})

Success prints a success message in green.

func Table

func Table(headers []string, rows [][]string)

Table prints data as a formatted table using stdlib tabwriter.

func Warn added in v0.1.5

func Warn(msg string, args ...interface{})

Warn prints a warning message in yellow.

func WithSpinner

func WithSpinner(msg string, fn func() error) error

WithSpinner runs fn while reporting progress.

Behavior by output mode:

  • Quiet/JSON: no output, just run fn. JSON consumers parse stdout so any heartbeat noise (even on stderr) pollutes tool-captured output in agents like Claude Code whose Bash tool merges both streams.
  • TTY text: animated spinner on stderr.
  • Non-TTY text (agents, pipes, logs): print the start message immediately, then emit a heartbeat line every heartbeatInterval showing elapsed time. This gives agents running `poof build` / `poof iterate` / `poof verify` visible progress in their captured stdout instead of nothing for 5-15 min.

Types

type Format

type Format int

Format controls how output is rendered.

const (
	FormatText  Format = iota // Human-readable
	FormatJSON                // Machine-readable JSON
	FormatQuiet               // Minimal output (IDs, URLs only)
)

func GetFormat

func GetFormat() Format

GetFormat returns the current output format.

Jump to

Keyboard shortcuts

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