reference

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 6 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 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

View Source
const Schema = 1

Schema is the version of the shape below. It changes only for a break.

Variables

View Source
var JSONSchema []byte

JSONSchema is the published schema document.

Functions

This section is empty.

Types

type Change

type Change struct {
	Release string `json:"release"`
	Summary string `json:"summary"`
}

Change is a release that changed what a rule reports.

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 ExitCode

type ExitCode struct {
	Code    int    `json:"code"`
	Meaning string `json:"meaning"`
}

ExitCode is one status a command exits with.

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.

func Build

func Build(version string, command Command, exitCodes []ExitCode) (Reference, error)

Build assembles the reference from the registries the rest of the binary already reads, around the command tree and exit codes cmd/archdoc supplies.

type Rule

type Rule struct {
	Code    string   `json:"code"`
	Title   string   `json:"title"`
	Summary string   `json:"summary"`
	Remedy  string   `json:"remedy"`
	Since   string   `json:"since"`
	Changes []Change `json:"changes"`
}

Rule is one lint rule's entry in the registry.

Jump to

Keyboard shortcuts

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