record

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 12 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 record is what the course's recorders share. scripts/tapes and scripts/episodes both serve the demo API on the port the lessons show, run a lesson's own commands as setup in a scratch directory, and hand vhs an environment with nothing of the recording machine's in the picture; one copy of each keeps the two recordings alike.

Index

Constants

View Source
const Port = 8089

Port is the port the lessons show in their URLs; a recording's picture carries it, so it is not negotiable the way learncheck's is.

Variables

This section is empty.

Functions

func Environment

func Environment(bin, work string) []string

Environment is what a recording's setup and vhs run under: the fresh apic in bin first on PATH, a HOME of its own under work, UTC and a UTF-8 locale, and nothing of the recording machine's that would show in the picture: no NO_COLOR, no proxy (`apic env` reports the one it sees) and no APIC_ variable, since an exported APIC_VAR_baseUrl or APIC_VAR_user would override the demo project's values in every shot.

func Pick

func Pick[T any](items []T, name func(T) string, only string) ([]T, error)

Pick keeps the items named in only, comma-separated, in the order given; an empty only keeps them all, and a name that matches nothing is an error, since a typo would otherwise record nothing and say so late.

func Serve

func Serve() (stop func(), err error)

Serve starts the demo API on Port, waiting a few seconds for the port when a recording's own `apic demo` is still letting go of it.

func Shell

func Shell(work string, env []string, code string) error

Shell runs code with sh -e in work, as learncheck runs the lessons' blocks, with colour off since nothing is recording.

Types

type Step

type Step struct {
	Sh      string
	Lesson  string // the page's number prefix, "09"
	Blocks  []int
	Replace [2]string
}

Step is one piece of a recording's setup: a shell snippet, or runnable blocks of a lesson page (1-based, in page order), optionally with a text substitution applied to them first.

func (Step) Code

func (s Step) Code(blocks []lessons.Block) (string, error)

Code is the shell the step runs: its snippet, or the lesson blocks it names (from blocks, the lesson's runnable blocks in page order), with the substitution applied. A substitution that matches none of the blocks is an error, since the step would silently run the unchanged lesson commands.

func (Step) Run

func (s Step) Run(root, work string, env []string) error

Run reads the step's lesson, if it names one, and runs its code in work.

Jump to

Keyboard shortcuts

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