go.bigb.es/auxilia
Documentation
Types
type AutoPrompter bool
AutoPrompter is a non-interactive prompter that answers every Confirm with a fixed boolean and every Select with the first option.
func (a AutoPrompter) Confirm(context.Context, string) (bool, error)
Confirm returns the configured fixed answer.
func (AutoPrompter) Select(_ context.Context, _ string, options []string) (int, error)
Select always picks the first option.
type CLIPrompter struct { In io.Reader Out io.Writer // contains filtered or unexported fields }
CLIPrompter answers interactive questions by reading from In and writing prompts to Out. It never touches os.Stdin/os.Stdout directly (PC2).
func (p *CLIPrompter) Confirm(_ context.Context, question string) (bool, error)
Confirm asks a yes/no question. An empty or unrecognized answer is treated as "no". A read error before any input is returned.
func (p *CLIPrompter) Select(_ context.Context, question string, options []string) (int, error)
Select presents numbered options and reads a 1-based choice, returning the 0-based index. A non-numeric or out-of-range answer is an error.
type Table struct { // contains filtered or unexported fields }
Table is a passive aligned-column renderer for terminal output. Cells may carry ANSI color escapes (e.g. a colored status); column widths are measured on visible runes so a colored cell aligns exactly as its plain twin. It is pure data-in, text-out: no I/O beyond the io.Writer passed to Render, and no dependency on the legatus core, transport, or sync.
NewTable returns a Table with the given column headers.
AddRow appends a row and returns the table for chaining. A row need not match the header count: shorter rows render the missing cells empty, longer rows add unheadered columns — Render derives the column count from the widest input.
Render writes the aligned table to w. Columns are left-aligned at the widest visible cell, separated by a two-space gutter, with no trailing whitespace and one newline per row. Output is deterministic for a given header+row set: the column order is construction order and no map iteration is involved. Write errors are ignored, matching TextReporter.
type TextReporter struct { W io.Writer Color bool }
TextReporter writes per-step progress lines and a final summary to W. When Color is set, glyphs are wrapped in ANSI color codes.
func (r *TextReporter) FlowDone(host string, res legatus.FlowResult)
FlowDone reports the aggregate status of a flow on a host.
func (r *TextReporter) FlowStart(host, flow string)
FlowStart announces the start of a flow on a host.
func (r *TextReporter) RunDone(res legatus.RunResult)
RunDone writes the final tally across all hosts.
func (r *TextReporter) StepDone(host string, res legatus.StepResult)
StepDone reports the outcome of a step with a status glyph.
func (r *TextReporter) StepStart(host, step string)
StepStart announces a step about to run on a host.
Package report provides human-facing implementations of the legatus Reporter and Prompter interfaces: a text progress reporter and CLI/auto prompters. These are the injectable interactivity/progress impls (PC2): self-contained, no globals, no direct os.Stdin/os.Stdout access — all I/O flows through the configured readers and writers.