presentation

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package presentation owns the closed CLI presentation grammar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Literal

func Literal(text string) (value, error)

Literal constructs a Value that preserves its horizontal spaces.

func Prompt

func Prompt(dst io.Writer, prelude Document, tail Value) error

Prompt renders a complete prelude atomically, then writes and flushes one validated prompt tail without a trailing newline before input is read.

func Prose

func Prose(text string) (value, error)

Prose constructs a Value after trimming and collapsing Unicode whitespace to one ASCII space.

func Render

func Render(dst io.Writer, document Document) error

Render validates document, renders it completely, then writes it once to dst.

Types

type Collection

type Collection struct {
	Status     string
	Categories []CollectionCategory
}

Collection is a representation-only ordered set of semantic record categories. Its owner supplies category labels, schemas, records, and order.

func (Collection) Document

func (c Collection) Document() (Document, error)

Document lowers a collection into the closed presentation tree.

type CollectionCategory

type CollectionCategory struct {
	Label   string
	Schema  []string
	Records []Record
	Values  []Value
}

CollectionCategory is one same-schema category in a Collection.

type Detail

type Detail struct {
	Fields   []Field
	Sections []Section
}

Detail is the standard shape for a detailed query. Its optional leading fields and ordered sections lower to a Document.

func (Detail) Document

func (d Detail) Document() (Document, error)

Document lowers Detail into the closed presentation tree.

type Diagnostic

type Diagnostic struct {
	Condition string
	State     string
	Changed   []Field
	Cause     string
	Steps     []Value
}

Diagnostic is a representation-only actionable failure. Its owner supplies all semantic labels, state, changed axes, cause, and ordered remedies.

func (Diagnostic) Document

func (d Diagnostic) Document() (Document, error)

Document lowers a diagnostic into the closed presentation tree.

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is a complete CLI presentation. Root fields must precede sections.

func NewDocument

func NewDocument(nodes ...Node) (Document, error)

NewDocument constructs a Document from ordered root nodes.

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field is a labeled scalar value.

func NewField

func NewField(label string, value value) (Field, error)

NewField constructs a Field with a grammar-valid label and nonempty value.

type List

type List struct {
	// contains filtered or unexported fields
}

List is a labeled collection of bare scalar leaves.

func NewList

func NewList(label string, values ...value) (List, error)

NewList constructs a labeled list of bare values.

type Mutation

type Mutation struct {
	Status      string
	Identity    []Field
	Changes     []MutationChange
	Notes       []Value
	NextActions []Value
}

Mutation is a representation-only completed operation. Its owner supplies status, identity, changed axes, notes, and ordered next actions.

func (Mutation) Document

func (m Mutation) Document() (Document, error)

Document lowers a mutation into the closed presentation tree.

type MutationChange

type MutationChange struct {
	Label  string
	Values []Value
}

MutationChange is one owner-named ordered group of mutation facts.

type Node

type Node interface {
	// contains filtered or unexported methods
}

Node is a grammar node. The closed implementation is Field, Section, List, RecordGroup, Record, and Steps.

type Record

type Record struct {
	// contains filtered or unexported fields
}

Record is a fixed-arity compact record leaf.

func NewRecord

func NewRecord(values ...value) (Record, error)

NewRecord constructs one fixed-arity compact record.

type RecordGroup

type RecordGroup struct {
	// contains filtered or unexported fields
}

RecordGroup is a labeled collection with one fixed record schema.

func NewRecordGroup

func NewRecordGroup(label string, schema []string, records ...Record) (RecordGroup, error)

NewRecordGroup constructs a labeled fixed-schema record collection.

type Report

type Report struct {
	Status     string
	Context    []Field
	Summary    []Field
	Categories []ReportCategory
}

Report is a representation-only complete check or audit result. Its owner supplies the status, context, summary, categories, schemas, and ordering.

func (Report) Document

func (r Report) Document() (Document, error)

Document lowers a report into the closed presentation tree.

type ReportCategory

type ReportCategory struct {
	Label   string
	Schema  []string
	Records []Record
}

ReportCategory is one semantic category of same-schema findings in a report.

type Section

type Section struct {
	// contains filtered or unexported fields
}

Section groups nested nodes under a label.

func NewSection

func NewSection(label string, nodes ...Node) (Section, error)

NewSection constructs a labeled nested group.

type Steps

type Steps struct {
	// contains filtered or unexported fields
}

Steps is a labeled ordered collection of actionable values.

func NewSteps

func NewSteps(label string, values ...value) (Steps, error)

NewSteps constructs a labeled ordered action collection.

type Value

type Value = value

Value is a validated scalar used by presentation nodes.

Jump to

Keyboard shortcuts

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