Documentation
¶
Index ¶
- Constants
- Variables
- func FormatAge(obj *unstructured.Unstructured) string
- func FormatDuration(d time.Duration) string
- func MapOffsets(rawText, displayText string, rawOffsets [][]int) [][]int
- type Builder
- func (b *Builder) AppendAt(level int, i *Builder) *Builder
- func (b *Builder) Build() Content
- func (b *Builder) KV(level int, key, value string, opts ...KVOption) *Builder
- func (b *Builder) KVMulti(level int, key string, m map[string]string, opts ...KVOption) *Builder
- func (b *Builder) KVStyled(level int, kind ValueKind, key, value string) *Builder
- func (b *Builder) RawLine(level int, text string) *Builder
- func (b *Builder) Section(level int, name string) *Builder
- type Content
- type Element
- type KVOption
- type ValueKind
Constants ¶
const ( LEVEL_0 = iota LEVEL_1 LEVEL_2 LEVEL_3 LEVEL_4 )
Level constants (each level = 2 spaces indentation).
Variables ¶
var ( YAMLKeyStyle = lipgloss.NewStyle().Foreground(theme.SyntaxKey) YAMLStringStyle = lipgloss.NewStyle().Foreground(theme.SyntaxString) YAMLNumberStyle = lipgloss.NewStyle().Foreground(theme.SyntaxNumber) YAMLBoolStyle = lipgloss.NewStyle().Foreground(theme.SyntaxBool) YAMLNullStyle = lipgloss.NewStyle().Foreground(theme.SyntaxNull) YAMLMarkerStyle = lipgloss.NewStyle().Foreground(theme.SyntaxMarker) )
YAML syntax-highlighting styles (exported).
Functions ¶
func FormatAge ¶
func FormatAge(obj *unstructured.Unstructured) string
FormatAge returns a human-readable age string for an Unstructured object.
func FormatDuration ¶
FormatDuration formats a duration as a human-readable age string (Xs/Xm/Xh/Xd).
func MapOffsets ¶
MapOffsets translates byte-offset pairs from raw (plain-text) space to display (ANSI-colored) space.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder accumulates typed elements and renders them with dynamic per-section alignment.
func (*Builder) AppendAt ¶
AppendAt appends existing builder's elements at the given indentation level.
func (*Builder) Build ¶
Build performs a two-pass render and returns a Content holding (raw, display) output. raw contains no ANSI escape codes; display contains styled output. The invariant ansi.Strip(display) == raw always holds.
func (*Builder) KVMulti ¶
KVMulti appends a key with a sorted map of key=value pairs. The first value appears on the same line as the key; subsequent values appear on continuation lines aligned to the same column. A nil or empty map renders as "<none>".
func (*Builder) KVStyled ¶
KVStyled appends a key-value element with a specific ValueKind for styling.
type Content ¶
Content holds the raw (plain-text) and display (ANSI-styled) representations of rendered content. The invariant ansi.Strip(c.Display) == c.Raw always holds.
func RenderEvents ¶
func RenderEvents(allEvents []*unstructured.Unstructured, kind, name, namespace string) Content
RenderEvents filters events matching the given resource, sorts newest-first, and returns a kubectl-style "Events:" table section as Content.
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element represents a single renderable item in the describe output.
type KVOption ¶
type KVOption func(*Element)
KVOption is a functional option for KV methods on Builder.
type ValueKind ¶
type ValueKind int
ValueKind tags a field value for semantic styling.
func ConditionKind ¶
ConditionKind maps a condition status string to a ValueKind for styling.
func StatusKind ¶
StatusKind maps a pod phase string to a ValueKind for styling.