pwtree

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pwtree lays out dotted configuration keys as an aligned tree.

The startup summary and pw doctor both report resolved configuration, and a reader who has learned one layout should not have to learn a second. The layout lives here so there is one implementation of it rather than two that drift.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayValue

func DisplayValue(value string) string

DisplayValue renders an empty value as an explicit pair of quotes, so a key that resolved to nothing is distinguishable from one that was not reported.

func Render

func Render(out *strings.Builder, lines []Line, sourceTag func(string) string, dim func(string) string)

Render writes the rows of Lines, padding each value and source mark into its sibling column. dim styles the source mark; pass a function that returns its argument unchanged to render without color.

Types

type Entry

type Entry struct {
	Key    string
	Value  string
	Source string
}

Entry is one reported key: its dotted name, the value as it should be shown, and the layer that won it. Masking is applied before an entry reaches here.

type Line

type Line struct {
	Label      string
	Column     int
	ValueWidth int
	Entry      *Entry
}

Line is one rendered row. Label already carries its branch characters, and Column and ValueWidth align a value and its source mark with the siblings that share a parent rather than with the deepest key in the whole tree.

func Lines

func Lines(entries []Entry) []Line

Lines groups entries by their dotted key and returns the rendered rows in declaration order. Entries are not sorted: the caller's order is the order a reader sees, because provenance order carries meaning.

Jump to

Keyboard shortcuts

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