cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 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) error

BuildRun appends a code block, executes it, and appends the output.

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.

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