ui

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ui provides terminal user interface components for the OCFP CLI.

Index

Constants

This section is empty.

Variables

View Source
var ASCII bool //nolint:gochecknoglobals // global rendering toggle for UI tables

ASCII controls whether Render prints ASCII-only tables. Defaults to false (use Unicode box-drawing where supported).

Functions

func Render

func Render(table *Table, format string) error

Render prints the table in the requested format: "table", "json", or "yaml". Stdout is reserved for UX output; logs should be file-only via the logger package.

func SetASCII

func SetASCII(on bool)

SetASCII sets ASCII-only rendering for tables.

Types

type Section

type Section struct {
	Title   string     `json:"title"   yaml:"title"`
	Headers []string   `json:"headers" yaml:"headers"`
	Rows    [][]string `json:"rows"    yaml:"rows"`
}

Section is a titled table with headers and rows.

type Table

type Table struct {
	Title    string    `json:"title"    yaml:"title"`
	Summary  string    `json:"summary"  yaml:"summary"`
	Sections []Section `json:"sections" yaml:"sections"`
}

Table represents a CLI-friendly plan with titled sections.

func NewTable

func NewTable(title string) *Table

NewTable creates a new Table with the given title.

func (*Table) AddRow

func (t *Table) AddRow(row []string)

AddRow adds a row to the table (to the first section).

func (*Table) AddSection

func (t *Table) AddSection(title string)

AddSection adds a new section to the table.

func (*Table) AddSeparator

func (t *Table) AddSeparator()

AddSeparator adds a separator row to the current section.

func (*Table) Render

func (t *Table) Render() error

Render renders the table to stdout using the default format.

func (*Table) SetHeaders

func (t *Table) SetHeaders(headers []string)

SetHeaders sets the headers for the table (creates a single section).

Jump to

Keyboard shortcuts

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