guide

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 3 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 guide holds what a command group tells an author, or an agent, about how to build for it: the terms of its DSL or format, and the rules that its validate command applies, each with its fix. A group declares a Spec and Checks once. Its spec command prints the Spec, and its validate help and problems read the Checks. Thus the rules come from the binary, not from a skill or a page that can be out of date.

Index

Constants

View Source
const Generated = "<!-- Code generated by osapi dsl docs. DO NOT EDIT. -->"

Generated is the first line of the body of each page that a command of this binary writes. A writer removes a page with it that it did not write.

Variables

This section is empty.

Functions

func Fill

func Fill(
	page string,
	name string,
	render func(args []string) string,
) string

Fill is page with the text between each pair of markers of name written again by render: <!-- osapi:<name> args --> starts the text, and <!-- /osapi:<name> --> ends it. render gets the args, the words after the name. A page keeps its own text around the markers. A start with no end is left as it is.

func MDX

func MDX(
	s string,
) string

MDX escapes the characters of s that MDX would parse, outside code spans: osapi-<key>.conf is a tag to MDX, {key} an expression and *x* emphasis. Inside a code span MDX reads nothing, so the text there stays as it is. A Markdown link stays a link: only its text is escaped.

Types

type Check

type Check struct {
	// Rule is the name that a problem reports.
	Rule string `json:"rule"`
	// Requires is what must be true.
	Requires string `json:"requires"`
	// Fix is how to fix what breaks the rule.
	Fix string `json:"fix"`
}

Check is one rule that a validate command applies: what is required, and how to fix what breaks it.

type Checks

type Checks []Check

Checks are the rules of a validate command, in order.

func (Checks) Fix

func (c Checks) Fix(
	rule string,
) string

Fix is the fix of rule, or "" for a rule without a check.

func (Checks) Help

func (c Checks) Help() string

Help is the list of checks for the help of a validate command, one item for each rule.

func (Checks) Requires

func (c Checks) Requires(
	rule string,
) string

Requires is what rule requires, or "" for a rule without a check. A layer that checks another layer's rule states it with these words.

type Kind

type Kind struct {
	Kind  string `json:"kind"`
	Title string `json:"title"`
}

Kind is a group of terms, with the title that spec shows above it.

type Section

type Section struct {
	Kind  string `json:"kind"  render:"-"`
	Title string `json:"title"`
	Terms []Term `json:"terms"            table:"blocks"`
}

Section is one kind of a Spec and its terms, as the spec command of a group prints them: a section for each kind, a block for each term.

type Spec

type Spec struct {
	Kinds []Kind `json:"kinds"`
	Terms []Term `json:"terms"`
}

Spec is every term of a DSL or format, in groups.

func (Spec) Markdown

func (s Spec) Markdown(
	title string,
	intro string,
	position int,
) string

Markdown is s as a page of the docs site, at position in its sidebar: the title, the intro, then a section for each kind with a heading for each term, what the term does, and when to use it.

func (Spec) Of

func (s Spec) Of(
	kind string,
) []Term

Of are the terms of kind, in order.

func (Spec) Sections

func (s Spec) Sections() []Section

Sections are the kinds of s in order, each with its terms.

type Term

type Term struct {
	// Kind groups the term, as one of the Spec's Kinds names it.
	Kind string `json:"kind" render:"-"`
	// Name is how the term is written, such as Key("field").
	Name string `json:"name"`
	// Does is what the term makes osapi do.
	Does string `json:"does" label:"-"`
	// When is when to use it.
	When string `json:"when" label:"Use"`
}

Term is one part of a DSL or format: how it is written, what it makes osapi do, and when to use it.

Directories

Path Synopsis
Package sdktypes lists the closed sets of pkg/sdk/types in a spec, from the SDK's own description of them (types.All), as package collectors lists gohai's collectors.
Package sdktypes lists the closed sets of pkg/sdk/types in a spec, from the SDK's own description of them (types.All), as package collectors lists gohai's collectors.

Jump to

Keyboard shortcuts

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