binding

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 10 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 binding reads a repo's harness binding, the file .physa/harness.toml that binds Physa's harness contract to the team's own commands, and says which level of the contract the repo meets: 0 with no binding, 1 with start and result, 2 with asks as well. It keeps every command exactly as written and never runs, parses or expands one. A binding that is not valid comes back as an Error naming every missing, unknown or wrongly typed key, with its line where the file has one.

Index

Constants

View Source
const Path = ".physa/harness.toml"

Path is where a repo keeps its harness binding, relative to the repo's root.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Run    Run
	Report Report
}

Binding is a harness binding: the team's command line for each verb of the harness contract, each exactly as written, or empty where none is bound.

func Load

func Load(path string) (Binding, error)

Load reads the binding in the file at path. A file that does not exist is no binding: the zero Binding, level 0, and no error. A file that cannot be read is an ordinary error. A file that is read but is not a valid binding is an *Error naming every problem.

func (Binding) Level

func (b Binding) Level() int

Level is the level the binding meets: 0 with no binding, 1 with start and result, 2 with asks as well. There are no keys for level 3 yet.

type Error

type Error struct {
	Problems []Problem
}

Error is a binding that was read but is not valid. Problems are in file order, with missing keys last.

func (*Error) Error

func (e *Error) Error() string

Error says every problem, one after another.

type Kind

type Kind int

Kind is what is wrong with a binding.

const (
	// NotTOML is a file that is not TOML.
	NotTOML Kind = iota + 1
	// WrongType is a key whose value is not what the binding needs there: a
	// table for run and report, a string for a command.
	WrongType
	// Unknown is a key the binding does not have.
	Unknown
	// Missing is a required command that is absent, empty or blank.
	Missing
)

The kinds of Problem.

type Problem

type Problem struct {
	// Kind is what is wrong.
	Kind Kind
	// Key is the key, dotted and spelled as written: "run.result", "reprt",
	// "run.Start". A part TOML would
	// quote is quoted. It is empty for a file that is not TOML.
	Key string
	// Line is the key's line in the file, from 1, or 0 where there is none,
	// as for a missing key.
	Line int
	// Detail is, for a file that is not TOML, the TOML library's message; for
	// a wrong type, what the key must be ("a string" or "a table").
	Detail string
	// contains filtered or unexported fields
}

Problem is one thing wrong with a binding.

func (Problem) String

func (p Problem) String() string

String says the problem for a person, naming its key and its line.

type Report

type Report struct {
	Asks    string
	Outcome string
	State   string
}

Report holds the commands a harness reports through: its asks, its outcomes and its state.

type Run

type Run struct {
	Start  string
	Result string
	Stop   string
}

Run holds the commands Physa calls to start a run, find where it ended up and stop it.

Jump to

Keyboard shortcuts

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