docmgr

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithRenderer

func ContextWithRenderer(ctx context.Context, r *Renderer) context.Context

ContextWithRenderer attaches a renderer to the context for downstream RenderTaxonomy calls.

func RenderTaxonomy

func RenderTaxonomy(ctx context.Context, tax *core.Taxonomy)

RenderTaxonomy renders diagnostics using a renderer attached to the context, falling back to the default renderer when no renderer is present.

Types

type Option

type Option func(*Renderer)

func WithCollector

func WithCollector() Option

WithCollector enables result collection for JSON output.

func WithRegistry

func WithRegistry(reg *rules.Registry) Option

WithRegistry supplies a custom registry (defaults to docmgrrules.DefaultRegistry()).

func WithWriter

func WithWriter(w io.Writer) Option

WithWriter overrides the text output destination (defaults to stderr).

func WithoutText

func WithoutText() Option

WithoutText disables text rendering (useful for tests/CI-only JSON).

type Renderer

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

Renderer renders diagnostics and can optionally collect results for JSON output.

func NewRenderer

func NewRenderer(opts ...Option) *Renderer

NewRenderer builds a renderer configured with docmgr rules and output options.

func (*Renderer) JSON

func (r *Renderer) JSON() ([]byte, error)

JSON renders collected results into pretty JSON.

func (*Renderer) Render

func (r *Renderer) Render(ctx context.Context, tax *core.Taxonomy)

Render renders the taxonomy, collecting results and printing text based on renderer options.

func (*Renderer) Results

func (r *Renderer) Results() []*rules.RuleResult

Results returns collected rule results (empty slice if none).

Jump to

Keyboard shortcuts

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