Documentation
¶
Overview ¶
Package usage describes a command's help as data, so the help a binary prints and the man page shipped for it are rendered from one source and cannot drift.
Index ¶
Constants ¶
const BudgetScopeNote = "A budget bounds one run — one evaluation, one " +
"instantiation, one calc invocation, one action, one state machine — not a " +
"whole session, so a long session of small operations never exhausts one. A " +
"run started inside another shares the outer run's budget."
A budget bounds one run rather than a session, which is the distinction a reader raising one needs.
const LegacyPrefixNote = "Each variable above also answers to its legacy " +
"SYSML_-prefixed name (SYSML_MAX_STEPS for OPENSYSML_MAX_STEPS, and so on), " +
"which remains accepted. When both are set and the OPENSYSML_ value is " +
"non-empty, the OPENSYSML_ value wins; setting only the legacy name prints a " +
"one-time deprecation warning on standard error."
LegacyPrefixNote states how the superseded variable names are still read, and belongs with any list of them.
const ManDir = "packaging/man/man1"
ManDir is where the shipped pages live, relative to the repository root.
Variables ¶
This section is empty.
Functions ¶
func CheckShippedPage ¶
CheckShippedPage reports whether the page committed under root still matches the description the command renders, naming the command to regenerate it.
Types ¶
type Doc ¶
type Doc struct {
// Command is the program name, as invoked and as the man page is titled.
Command string
// ManSection is the manual section the page belongs in.
ManSection int
// Summary is the one-line description of the command, for the NAME section.
Summary string
// Synopsis holds the invocation forms, without the program name.
Synopsis []string
// Description holds the paragraphs a reader needs before the flags.
Description []string
// Options groups the flags by the task they serve, in the order printed.
// Empty, the flags are listed as the flag set declares them.
Options []OptionGroup
// Sections are the blocks printed after the options, in order.
Sections []Section
// SeeAlso names related pages as "name(section)", plus any URLs.
SeeAlso []string
}
Doc is everything the help and the man page say about one command, apart from the flags themselves: those are read from the command's own flag set, which is the only place a flag is declared.
func (Doc) CheckOptions ¶
CheckOptions reports a flag the groups leave out or name twice, or an option the flag set does not declare, so a flag cannot go undocumented.
func (Doc) WriteHint ¶
WriteHint writes what a misuse is answered with: the synopsis and where the help is, rather than the help itself, which would bury the error.
type Item ¶
Item is one labelled entry of a list: a variable, a status, a file.
func BudgetEnvironment ¶
func BudgetEnvironment() []Item
BudgetEnvironment describes the run bounds every binary reads, in one wording for all three pages. docs/reference/environment.md is the long form.
func JobsEnvironment ¶
func JobsEnvironment() []Item
JobsEnvironment describes the setting the binaries that answer analysis questions read for how many runs of one plan go concurrently.
func ToolEnvironment ¶
func ToolEnvironment() []Item
ToolEnvironment describes the tool manifest and its timeout, which every binary that performs actions annotated ToolExecution reads.
type ManMeta ¶
ManMeta is the page's title line: the date it documents, the project the command belongs to, and the manual it is part of.
func DefaultManMeta ¶
func DefaultManMeta() ManMeta
DefaultManMeta is the title line the toolchain's pages share, dated from SOURCE_DATE_EPOCH where a reproducible build sets it.
type Option ¶
type Option struct {
// Name is the flag as declared, without its dash.
Name string
// Aliases are the other spellings the flag set declares for the same
// setting, listed with the name rather than as entries of their own.
Aliases []string
// Arg is the argument's placeholder, "<name>", or "[=<name>]" when optional;
// empty for a boolean flag.
Arg string
}
Option is one entry of the option list: a flag with its alternative spellings.
type OptionGroup ¶
type OptionGroup struct {
// Title heads the block: "Checking a model", "Deprecated".
Title string
Options []Option
}
OptionGroup is one titled block of the option list.
type Section ¶
type Section struct {
// Title heads the block: "Examples", "Conversion".
Title string
// Lead is the prose introducing what the block lists.
Lead []string
// Examples are commands with the comment explaining each.
Examples []Example
// Items are labelled descriptions: environment variables, exit statuses.
Items []Item
// Paragraphs is the prose closing the block.
Paragraphs []string
// BeforeOptions prints the block ahead of the option list in the terminal
// help, for the examples a reader wants before any flag.
BeforeOptions bool
// ManOnly keeps the block out of the terminal help, for reference material
// that belongs in a page a reader consults rather than in a flag summary.
ManOnly bool
}
Section is one titled block of the help: worked examples, prose, a labelled list, or a combination, rendered in that order.