usage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 9 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 = "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
	// 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) Section

func (d Doc) Section() int

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

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 flags as the flag set itself describes them, then every 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.

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 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
	// 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