display

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SumUpPink = lipgloss.Color("#FF61F2")

Functions

func DataList

func DataList(w io.Writer, pairs []attribute.KeyValue) error

DataList renders key/value pairs as "Key: Value" rows where keys are bold.

func PrintJSON

func PrintJSON(w io.Writer, v any) error

PrintJSON renders the value as pretty JSON.

func RenderMutation

func RenderMutation(output, statusOutput io.Writer, jsonOutput bool, result MutationResult) error

RenderMutation renders a mutating command result consistently for JSON and human output.

func RenderSections

func RenderSections(w io.Writer, sections []Section) error

RenderSections renders titled output blocks with a blank line between them.

func RenderTable

func RenderTable(w io.Writer, title string, headers []string, rows [][]attribute.Value) error

RenderTable prints rows in a table using the terminal width to wrap columns.

func RenderTableWithOptions

func RenderTableWithOptions(w io.Writer, headers []string, rows [][]attribute.Value, opts TableOptions) error

RenderTableWithOptions prints rows in a table using configurable presentation options.

Types

type DetailsBuilder

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

DetailsBuilder helps commands build detail views without manual slice plumbing.

func NewDetailsBuilder

func NewDetailsBuilder() *DetailsBuilder

func (*DetailsBuilder) Add

func (b *DetailsBuilder) Add(key string, value attribute.Value) *DetailsBuilder

func (*DetailsBuilder) AddID

func (b *DetailsBuilder) AddID(value any) *DetailsBuilder

func (*DetailsBuilder) AddOptionalString

func (b *DetailsBuilder) AddOptionalString(key string, value *string) *DetailsBuilder

func (*DetailsBuilder) AddPair

func (b *DetailsBuilder) AddPair(pair attribute.KeyValue) *DetailsBuilder

func (*DetailsBuilder) AddWhen

func (b *DetailsBuilder) AddWhen(ok bool, pair attribute.KeyValue) *DetailsBuilder

func (*DetailsBuilder) Pairs

func (b *DetailsBuilder) Pairs() []attribute.KeyValue

func (*DetailsBuilder) Render

func (b *DetailsBuilder) Render(w io.Writer) error

type MutationResult

type MutationResult struct {
	JSONValue      any
	SuccessMessage string
	Details        []attribute.KeyValue
	RenderHuman    func(io.Writer) error
}

MutationResult describes the shared output flow for mutating commands.

type Section

type Section struct {
	Title string
	Pairs []attribute.KeyValue
	Lines []string
}

Section groups related output under a title.

type TableOptions

type TableOptions struct {
	Title             string
	EmptyText         string
	IdentifierColumns []int
}

TableOptions customizes human-readable table rendering.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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