clioutput

package
v0.1.0-rc.41 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package clioutput renders stable human-readable CLI diagrams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandOf

func CommandOf(err error) (string, bool)

CommandOf returns the nearest attached command context from a non-nil wrapper.

func CommandTitle

func CommandTitle(program, path string) string

CommandTitle returns a canonical command title without argument placeholders.

func Render

func Render(frame Frame) (string, error)

Render returns a complete frame ending in one newline.

func WrapCommand

func WrapCommand(command string, err error) error

WrapCommand attaches command context to err.

func Write

func Write(output io.Writer, frame Frame) error

Write renders frame to output with a blank line after its closing rail.

Types

type Block

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

Block is content rendered inside a Frame.

func Fields

func Fields(values ...Field) Block

Fields renders aligned label-value pairs.

func Flow

func Flow(nodes ...FlowNode) Block

Flow renders nodes connected vertically by v or x markers.

func Section

func Section(title string, blocks ...Block) Block

Section renders a titled divider followed by content.

func Text

func Text(value string) Block

Text renders wrapped prose.

func Transition

func Transition(from, detail, to string) Block

Transition renders one healthy transition between two values.

func Tree

func Tree(root TreeNode) Block

Tree renders a hierarchy with ASCII branches.

type Field

type Field struct {
	Label string
	Value string
}

Field is one label and value in an aligned field list.

type FlowNode

type FlowNode struct {
	Label   string
	Detail  string
	Failure bool
}

FlowNode is one node in a vertical flow. Detail and Failure describe the connection from this node to the next node.

type Frame

type Frame struct {
	Command string
	State   string
	Blocks  []Block
	Footer  string
}

Frame is one complete human-readable command result or diagnostic.

type TreeNode

type TreeNode struct {
	Label    string
	Value    string
	Children []TreeNode
}

TreeNode is one node in an ASCII tree.

Jump to

Keyboard shortcuts

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