Documentation
¶
Overview ¶
Package reference describes ArchDoc itself as data: its commands, its lint rules, the front matter of each type, its configuration, its exit codes and the export schema, so a site documenting a release can be generated from the release rather than written again by hand.
The shape is a contract held to the rule ADR-0019 sets for the export: before ArchDoc 1.0, a change that removes a field, or changes a field's type or meaning, moves Schema to the next integer, at most once between two tagged releases. From 1.0 it only gains optional fields.
The command tree is walked in cmd/archdoc, the only package that imports cobra, which fills Command.
Index ¶
Constants ¶
const Schema = 1
Schema is the version of the shape below. It changes only for a break.
Variables ¶
var JSONSchema []byte
JSONSchema is the published schema document.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Path string `json:"path"`
Use string `json:"use"`
Short string `json:"short"`
Long string `json:"long"`
Flags []Flag `json:"flags"`
// GlobalFlags are the persistent flags this command defines, which its
// subcommands inherit.
GlobalFlags []Flag `json:"global_flags"`
Commands []Command `json:"commands"`
}
Command is one command, with its subcommands in the order help lists them.
type ConfigKey ¶
type ConfigKey struct {
Key string `json:"key"`
Type string `json:"type"`
Required bool `json:"required"`
Default any `json:"default,omitempty"`
Description string `json:"description"`
}
ConfigKey is one key of archdoc.json. Default is absent for a key with none.
type Flag ¶
type Flag struct {
Name string `json:"name"`
Shorthand string `json:"shorthand"`
Type string `json:"type"`
Default string `json:"default"`
Usage string `json:"usage"`
}
Flag is one flag, its type and default as the flag library gives them.
type Key ¶
type Key struct {
Key string `json:"key"`
Type string `json:"type"`
Required bool `json:"required"`
MayBeEmpty bool `json:"may_be_empty"`
Values []string `json:"values"`
}
Key is one front matter key of a type.
type Reference ¶
type Reference struct {
Schema int `json:"schema"`
Version string `json:"version"`
Command Command `json:"command"`
Rules []Rule `json:"rules"`
FrontMatter map[string][]Key `json:"front_matter"`
Config []ConfigKey `json:"config"`
ExitCodes []ExitCode `json:"exit_codes"`
ExportSchema json.RawMessage `json:"export_schema"`
}
Reference is the whole document `archdoc reference` prints.