xff v0.8.0

Shell Style

The shell style for MBO Works repositories. Follow the
Google Shell Style Guide unless this document
or the repository's automated tooling says otherwise.

Tooling

The shfmt and shellcheck versions and arguments are pinned in
.pre-commit-config.yaml. Run pre-commit run --files FILE... before
committing shell changes.

Functions return values; they do not mutate callers

A function does not communicate a result by changing a caller variable, a global counter, the
working directory, shell options, traps, or other hidden caller state. Return text on standard
output and capture it with command substitution:

_tree() {
  local root
  root="$(test_tmpdir tree)"
  mkdir -p "${root}/src"
  echo "${root}"
}

root="$(_tree)"

Do not use _tree root with printf -v, eval, or a global sequence counter. Command substitution
runs the function in a subshell, so hidden state changes would disappear and make the interface
misleading.

An operation whose purpose is an external effect may perform that named effect: a fixture builder
creates files, a runner starts a command, and a release script updates the files it is explicitly
given. Keep the effect local and explicit, and reserve standard output for the documented result.
Diagnostics go to standard error.

Tests and temporary files

Portability and repository conventions