reference

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package reference renders the Spec pages of funcd and funcdctl from the config struct and the command trees (ADR-0324).

Index

Constants

View Source
const DevAnnotation = "build"

DevAnnotation marks, in a command's Annotations, a command that only the -tags dev build registers.

View Source
const Marker = "# Generated by just generate from the config struct and the command trees: change the code, not this page."

Marker is the first line of each page's front matter.

Variables

This section is empty.

Functions

func Cell added in v0.44.2

func Cell(text string) string

Cell makes text fit one Markdown table cell of an MDX page; it serves a paragraph too. Outside code spans it escapes a pipe, the characters that open a tag or an expression, every * and ~, and an _ beside anything but a letter or a digit: Markdown reads those as emphasis or strikethrough, while an _ inside a word, as in FUNCD_TOKEN, stays text. Inside a code span only a pipe is escaped. A code span opens with a run of backticks and closes at the next run of the same length, as CommonMark reads it, so a reStructuredText span between two double backticks stays code; a run that nothing closes is text.

func CommandTables

func CommandTables(cmds []Command) []byte

CommandTables renders each command as a heading, its usage line and text, and a table of its flags.

func ConfigTable

func ConfigTable(keys []ConfigKey) []byte

ConfigTable renders keys as one Markdown table, laid out as the kinds' Spec pages are (ADR-0323).

func Page

func Page(title, description string, sections ...[]byte) []byte

Page renders a Spec page: front matter that starts with Marker, then the sections in order.

func Stale

func Stale(path string, page []byte) error

Stale returns an error naming path when the file at path is missing or differs from page.

func Variables

func Variables(dirs ...string) ([]string, error)

Variables lists, sorted, the FUNCD_* variables that config.Config's env tags and the Go files in dirs name: those a page test gives values of their own before it builds a command tree (ADR-0324 Decision 3).

Types

type Command

type Command struct {
	Path, Use, Short, Long string
	DevOnly                bool
	Flags                  []Flag
}

Command is one visible command and its flags.

func Commands

func Commands(root *cobra.Command) ([]Command, error)

Commands lists every visible command under root, depth first, root first, with cobra's help and completion commands added as --help lists them. It fails, naming the command and the flag, on a text or a flag usage that names an ADR, and on a default that holds the value of a set FUNCD_* variable or has a part, split at "/", equal to the host's runtime.GOOS or runtime.GOARCH (ADR-0324 Decision 3).

type ConfigKey

type ConfigKey struct {
	Path, Type, Default, Limits, Env, Description string
}

ConfigKey is one leaf key of funcdconfig.yaml.

func ConfigKeys

func ConfigKeys(defaults config.Config) []ConfigKey

ConfigKeys lists every leaf key of config.Config in declaration order, its default taken from defaults.

type Flag

type Flag struct {
	Name, Shorthand, Type, Default, Usage string
}

Flag is one flag of a command.

Jump to

Keyboard shortcuts

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