inline

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package inline implements the non-TUI inline status reporter.

Index

Constants

This section is empty.

Variables

View Source
var ChromeWriter = os.Stderr

ChromeWriter writes to stderr — decorations, spinners, labels. This is where TUI chrome goes so it doesn't corrupt piped data.

View Source
var DataWriter = os.Stdout

DataWriter writes to stdout — data only, pipe-safe. This is where machine-parseable output goes.

Functions

func Chrome

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

Chrome prints decorative output to stderr if stderr is a TTY. When stderr is not a TTY (e.g., 2>/dev/null), chrome is suppressed.

func ChromeLn

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

ChromeLn prints decorative output to stderr with a newline, if stderr is a TTY.

func Data

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

Data prints machine-parseable output to stdout.

func DataLn

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

DataLn prints machine-parseable output to stdout with a newline.

func FormatStatusLine

func FormatStatusLine(stats *afclient.StatsResponse) string

FormatStatusLine renders a one-line fleet summary from stats.

func PrintStatus

func PrintStatus(ds afclient.DataSource) error

PrintStatus fetches fleet stats and prints a one-line summary to stdout. Chrome (header, timestamp) goes to stderr for pipe compatibility.

func RunWatch

func RunWatch(ds afclient.DataSource, cfg WatchConfig) error

RunWatch starts a watch loop that refreshes status at the configured interval. For TTY stdout: overwrites the line in-place using \r and ANSI clear-to-EOL. For non-TTY stdout (piped): prints a new line each interval. For JSON mode: emits newline-delimited JSON (NDJSON). Handles SIGINT/SIGTERM gracefully, exiting with code 0.

Types

type WatchConfig

type WatchConfig struct {
	Interval time.Duration
	JSON     bool
}

WatchConfig holds configuration for the watch loop.

Jump to

Keyboard shortcuts

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