cmd

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec added in v0.4.0

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

Exec 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 Image added in v0.4.0

func Image(file, input, workdir string) error

Image appends an image reference to a showboat document. The input is either a plain path to an image file or a markdown image reference of the form ![alt text](path). When a markdown reference is provided the alt text is preserved; otherwise it is derived from the generated filename.

func Init

func Init(file, title, version string) error

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

func Note added in v0.4.0

func Note(file, text string) error

Note appends a commentary block to an existing showboat document.

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