Documenting Configuration
Single-page view · as markdown
Writing regman Pages
Peios / Developing for Peios / Documenting Configuration
Ship a .regman fragment with your component so an operator can look up
its registry keys and values with regman. Keep the fragment beside the
code that reads those values, and update both together.
Before you start #
- Install
regmanfrom Peiosutils. - Identify the keys your component owns and the values it reads.
- Follow regman and evman prose style.
Document another component's key by referring to its full path in your record's body. Do not publish a second definition of that key.
Write a fragment #
- Create a file named for your component, such as
exampled.regman. - Add a key record explaining the subtree, then a record for each value.
- Write a standalone summary as the first nonempty body line. Explain the effect, trade-offs, dependencies, and unusual cases in the remaining body.
This example describes an illustrative spooler and its queue limit:
--- machine\system\exampled
canonical: Machine\System\Exampled
Tuning parameters for the Exampled spooler.
--- machine\system\exampled maxqueuedepth
canonical: Machine\System\Exampled MaxQueueDepth
type: REG_DWORD
default: 1024
valid: 16–65536
applies: restart
Maximum number of jobs held in the spool queue before submissions are rejected.
Increase the limit to absorb longer bursts. Each queued job consumes memory.
The spooler reads this value when it starts.
The fence starts a record. Header lines continue until the first blank
line, and the body continues until the next fence. canonical supplies the
human-readable registry path and, for a value, its name after a space.
regman fmt derives the anchor from this header through Unicode simple
case folding. Do not maintain the folded anchor by hand.
A record with any type, default, valid, or applies header is a value
record. Supply all four for a useful value description. A record without
those headers describes a key. deprecated adds a deprecation notice;
explain the replacement and its limitations in the body.
Header names are case-insensitive, and surrounding whitespace is trimmed.
Unknown headers are ignored, so a typo can silently remove information.
A record without canonical is invalid and cannot provide a lookup result.
Check the rendered record as well as the lint result.
Format and check #
-
Format and lint the fragment:
-
Preview it from the directory containing only the fragments under review:
REGMAN_DIR="" REGMAN_DIR="" -
Compare every header with the implementation. Confirm the allowed type, bounds, behavior when absent, and point at which a changed value takes effect.
Formatting updates anchors without rewriting the body, preamble, or line endings. Running it twice should produce the same file. Lint checks record structure and anchors; it cannot prove that the program implements the prose.
default describes the component's behavior, not the value on the machine
running regman. Use live, restart, or reboot for applies, with a
short parenthetical qualification when needed.
Package the fragment #
- Include
exampled.regmanin the package payload asusr/share/regman/exampled.regman. - Install it with the component that owns the documented keys.
- Check the installed lookup before releasing the package.
The filename stem identifies the provider in lookup results. Installation requires no registration hook. An absent documentation directory means no fragments, not a broken registry. If an installation mechanism replaces files in place, use atomic replacement so readers do not see a partial fragment.
An index is an optional lookup optimization. The reader can scan fragments when the index is absent, stale, or invalid. Do not make correctness depend on generating an index during installation.
Check the result #
The key lookup shows the subtree summary and its values. The value lookup shows its headers and body under the expected provider. A second provider for the same record indicates overlapping ownership; resolve that overlap before shipping.
For dynamic names, use Registry Documentation Patterns.
Registry Documentation Patterns
Peios / Developing for Peios / Documenting Configuration
Registry documentation patterns describe families of keys without publishing one record for every instance. Use a pattern only where the implementation accepts dynamic names; a literal record makes a fixed name easier to verify.
Match dynamic names #
In a canonical path, <name> matches one path component. <name...> matches
one or more components separated by backslashes. The label inside the brackets
explains the role to a reader; it does not constrain the matched text.
Neither pattern matches a space. The format has no escape for a literal name
that itself has this placeholder shape.
For example, Machine\Software\Example\Profiles\<profile> describes one
profile key. A pattern ending in <path...> also reaches its descendants.
Use the narrower form when the documented behavior applies to one level.
Literal matches take precedence over patterns. Among patterns, more specific matches take precedence over broader ones. Key and value lookup remain separate: a matching key record does not define all its values.
Dots do not split registry components. A value pattern such as Local.<op>
can match Local.User.Equal as well as Local.Equal. If those names have
different meanings, document the operators explicitly instead of relying on
placeholder labels to separate them.
Overlapping records from different providers remain visible. Provider order is not a mechanism for overriding another package's documentation.
Write terminal prose #
Use paragraphs, headings, bullet lists, bold, and code spans. The renderer rewraps paragraphs to terminal width. Follow the shared prose style and avoid relying on emphasis styling that a plain-text terminal cannot represent. Unmatched markup remains literal; whitespace inside an emphasis marker can prevent it from being recognized.
A line beginning with --- starts another record, even in body text. Use
*** or ___ for a horizontal separator if one is needed. Keep examples of
record fences out of a fragment's prose.
Piped output and NO_COLOR suppress terminal styling. Review both styled and
plain output when presentation carries meaning. State a warning in words;
color alone cannot communicate it.
Keep format and meaning separate #
Headers such as access or since do not extend the parser's schema. Put
required access and relevant constraints in the body, and omit historical
narrative. Unknown headers being ignored does not make them supported.
Regman does not read the live registry to validate a documented default or range. Review those claims against the consuming code, including how that code handles a missing or malformed value.