cmd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommentary

func BuildCommentary(file, text string) error

BuildCommentary appends a commentary block to an existing showboat document.

func BuildImage

func BuildImage(file, script, workdir string) error

BuildImage appends an image code block, runs the script, captures the image.

func BuildRun

func BuildRun(file, lang, code, workdir string) (string, int, error)

BuildRun appends a code block, executes it, and appends the output. It returns the captured output, the process exit code, and any error.

func Extract

func Extract(file, outputFile string) ([]string, error)

Extract parses a showboat document and returns the sequence of CLI commands that would recreate it. OutputBlock and ImageOutputBlock are skipped since they are generated by running code blocks. If outputFile is non-empty it is used as the filename in the emitted commands; otherwise the input file path is used.

func Init

func Init(file, title string) error

Init creates a new showboat document with a title and timestamp. Returns an error if the file already exists.

func Pop added in v0.3.0

func Pop(file string) error

Pop removes the most recent entry from a showboat document. A "run" or "image" entry consists of a code block and its output, so both blocks are removed. A commentary entry is a single block. The title block cannot be removed.

Types

type Diff

type Diff struct {
	BlockIndex int
	Expected   string
	Actual     string
}

Diff represents a mismatch between expected and actual output of a code block.

func Verify

func Verify(file, outputFile, workdir string) ([]Diff, error)

Verify re-executes all code blocks and compares outputs. If outputFile is non-empty, an updated copy of the document is written there. If workdir is non-empty, code blocks are executed in that directory.

func (Diff) String

func (d Diff) String() string

String returns a human-readable description of the diff.

Jump to

Keyboard shortcuts

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