reference

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 14 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 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