usage

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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.

View Source
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

func CheckShippedPage(root string, d Doc, fs *flag.FlagSet) error

CheckShippedPage reports whether the page committed under root still matches the description the command renders, naming the command to regenerate it.

func Page

func Page(d Doc, fs *flag.FlagSet) []byte

Page renders the command's manual page as the shipped file holds it.

func Wrap

func Wrap(text string, width int) string

Wrap breaks text into lines of at most width characters, so a sentence printed rather than restated still reads as a paragraph.

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

func (d Doc) CheckOptions(fs *flag.FlagSet) error

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) Section

func (d Doc) Section() int

Section is the manual section the page belongs in, 1 where none is stated.

func (Doc) WriteHint

func (d Doc) WriteHint(w io.Writer)

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.

func (Doc) WriteRoff

func (d Doc) WriteRoff(w io.Writer, fs *flag.FlagSet, meta ManMeta)

WriteRoff writes the man page for the command in the man macro package, from the same description the terminal help is rendered from.

func (Doc) WriteText

func (d Doc) WriteText(w io.Writer, fs *flag.FlagSet)

WriteText writes the terminal help to w: the synopsis, the sections wanted first, the flags by group, then every other section not reserved for the man page.

type Example

type Example struct {
	Command string
	Comment string
}

Example is one invocation and what it does.

func Ex

func Ex(command, comment string) Example

Ex is an example invocation and the comment explaining it.

type Item

type Item struct {
	Label string
	Text  string
}

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 Entry

func Entry(label, text string) Item

Entry is one labelled description of a list.

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 LoadJobsEnvironment added in v0.9.2

func LoadJobsEnvironment() []Item

LoadJobsEnvironment is JobsEnvironment for a binary that also loads files: the same count bounds how many files of one load are parsed and validated at once.

func ToolEnvironment

func ToolEnvironment() []Item

ToolEnvironment describes the tool manifest and its timeout, which every binary that performs actions annotated ToolExecution reads.

type ManMeta

type ManMeta struct {
	Date   string
	Source string
	Manual string
}

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.

func Opt

func Opt(name, arg string, aliases ...string) Option

Opt is an option list entry for the flag name, with the argument placeholder arg ("" for a boolean flag) and any alternative spellings.

type OptionGroup

type OptionGroup struct {
	// Title heads the block: "Checking a model", "General".
	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.

Jump to

Keyboard shortcuts

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