structured

package
v0.2.32 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(cmd *cobra.Command, model any, spec Spec) error

Types

type Column

type Column struct {
	Header   string
	Template string
}

type Command

type Command[I any] struct {
	Use    string
	Short  string
	Long   string
	Args   cobra.PositionalArgs
	Input  func(*cobra.Command) I
	Action func(context.Context, *cobra.Command, I, []string) (any, error)
	Render Spec
}

func (Command[I]) Cobra

func (c Command[I]) Cobra() *cobra.Command

type Parent

type Parent struct {
	Use      string
	Short    string
	Long     string
	Children []func() *cobra.Command
}

func (Parent) Cobra

func (p Parent) Cobra() *cobra.Command

type Property added in v0.2.31

type Property struct {
	Label     string
	Template  string
	OmitEmpty bool
}

type PropertyList added in v0.2.31

type PropertyList struct {
	Title      string
	Properties []Property
}

func (PropertyList) RenderText added in v0.2.31

func (p PropertyList) RenderText(w io.Writer, model any) error

type Spec

type Spec interface {
	RenderText(io.Writer, any) error
}

type Table

type Table struct {
	Title   string
	Rows    string
	Columns []Column
}

func (Table) RenderText

func (t Table) RenderText(w io.Writer, model any) error

type Template

type Template string

func (Template) RenderText

func (s Template) RenderText(w io.Writer, model any) error

Jump to

Keyboard shortcuts

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