crap

package
v0.0.0-...-058375e Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package crap hosts the ndjson-crap producers that back the `::` (large-colon) toolkit: converters that turn test-runner and command output into ndjson-crap (see go-crap/ndjsoncrap). The canonical wire format is ndjson-crap and the canonical presenter is the viewport (go-crap/viewport, the crap-present binary); these producers only emit records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCargoTest

func ConvertCargoTest(r io.Reader, w io.Writer) int

ConvertCargoTest reads `cargo test` pretty output from r and writes ndjson-crap to w: one top-level test record per suite, with the suite's tests nested as subtest records. Returns an exit code: 0 when no suite failed, 1 otherwise.

func ConvertExec

func ConvertExec(ctx context.Context, name string, args []string, w io.Writer) int

ConvertExec runs a single command and writes an execution-family ndjson-crap stream to w: a node_start, an output record per captured line (stdout and stderr interleaved in arrival order), and a node_end carrying the exit code or terminating signal. Returns the command's exit code (or 1 if it could not be started).

func ConvertExecOpts

func ConvertExecOpts(ctx context.Context, name string, args []string, w io.Writer, opts ExecOptions) int

ConvertExecOpts is ConvertExec with an explicit node id and label. On failure (start error, nonzero exit, or signal) the node_end carries a diagnostic ({"error": ..., "command": ...}) so the node is a self-sufficient verdict unit (docs/ndjson-crap-schema.md); the field is absent on success.

func ConvertGoTest

func ConvertGoTest(r io.Reader, w io.Writer) int

ConvertGoTest reads `go test -json` events from r and writes ndjson-crap to w: one top-level test record per package, with the package's tests (and their subtests) nested as subtest records. Returns an exit code: 0 when no package failed, 1 otherwise.

Types

type ExecOptions

type ExecOptions struct {
	// TP is the stream-unique node id stamped on the node_start / output /
	// node_end records. Zero means 1.
	TP int
	// Name is the rendered node label (node_start.name). Empty means the
	// joined command line.
	Name string
}

ExecOptions adjusts how ConvertExecOpts shapes its execution-family records, so shell orchestrators can concatenate several invocations into one multi-node stream.

Source Files

  • cargotest.go
  • exec.go
  • gotest.go
  • produce.go

Directories

Path Synopsis
module
cmd
crap-present command
Command crap-present reads ndjson-crap on stdin and renders it with the CRAP-2 viewport on the terminal (stderr).
Command crap-present reads ndjson-crap on stdin and renders it with the CRAP-2 viewport on the terminal (stderr).
large-colon command
Command large-colon (invoked as `::`) is the CRAP-2 toolkit.
Command large-colon (invoked as `::`) is the CRAP-2 toolkit.
Package crap is the producer-side reporter API for ndjson-crap (crap RFC 0001 §10).
Package crap is the producer-side reporter API for ndjson-crap (crap RFC 0001 §10).
Package ndjsoncrap defines ndjson-crap: the canonical newline-delimited JSON wire format for CRAP-2 streams, and a tolerant reader/writer for it.
Package ndjsoncrap defines ndjson-crap: the canonical newline-delimited JSON wire format for CRAP-2 streams, and a tolerant reader/writer for it.
Package presentcli is the shared command glue for the ndjson-crap presenter, used by both the `:: present` subcommand and the standalone `crap-present` binary.
Package presentcli is the shared command glue for the ndjson-crap presenter, used by both the `:: present` subcommand and the standalone `crap-present` binary.
Package viewport is the CRAP-2 TTY presenter: a bubbletea model that renders a spinner + rolling log tail and, when a total is known, a progress bar, plus a driver that turns an ndjson-crap stream into the messages that feed it.
Package viewport is the CRAP-2 TTY presenter: a bubbletea model that renders a spinner + rolling log tail and, when a total is known, a progress bar, plus a driver that turns an ndjson-crap stream into the messages that feed it.

Jump to

Keyboard shortcuts

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