Documentation
¶
Overview ¶
Package commandcatalog turns an assembled cobra command tree into a structured, group-ordered catalog and renders it for two surfaces: a terminal cheat-sheet (used by `vaultmind help`) and a markdown reference (used by `vaultmind docs commands` and embedded into onboarding).
It is a pure transform — one generator, multiple consumers (SSOT). The catalog's group order, titles, and the "when"-annotation key are supplied by the caller (cmd/zz_catalog.go owns those constants), so this package carries no knowledge of VaultMind's specific groups and stays trivially testable against a fixture cobra tree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderMarkdown ¶
RenderMarkdown renders the catalog as a stable markdown reference: an H1 title, then an H2 + table per group with Command / What / When columns. The output is deterministic (groups in declared order, commands path-sorted) so it can back a regenerate-and-diff drift gate.
func RenderTerminal ¶
RenderTerminal renders the catalog as a grouped cheat-sheet for `help`: a title line per group, then one block per command — its path, its Short, and an indented "when you ..." trigger line.
Types ¶
type Catalog ¶
type Catalog struct {
Groups []CatalogGroup
}
Catalog is the full structured result: groups in declared order, each with its path-sorted commands. Groups with no commands are omitted.
func Build ¶
Build walks the assembled command tree and returns a Catalog: every non-hidden command that carries a registered GroupID is bucketed into its group. Hidden commands and commands with no (or an unregistered) GroupID are excluded. Groups render in opts.Groups order; commands within a group are path-sorted. Empty groups are dropped.
type CatalogGroup ¶
CatalogGroup is a rendered group: its title plus its member commands, path-sorted for deterministic output.
type Command ¶
Command is one cataloged command: its full invocation path, the Short (the WHAT line) and the when-to-use trigger (the WHEN line).
type Options ¶
type Options struct {
// Groups lists the catalog groups in the order they should render.
Groups []Group
// WhenKey is the Annotations key carrying the when-to-use trigger phrase.
WhenKey string
}
Options configures Build: the groups in display order and the cobra Annotations key under which each command's when-to-use trigger is stored.