//! Process-wide output-format state, split out of the `commands` god-module. The global `--json`
//! flag is pinned once in `main` and read by `print_output` (~30 call sites) without threading an
//! `OutputFormat` through every command signature.
use OnceLock;
use OutputFormat;
/// Process-wide output format, set once from the global `--json` flag in `main` before any command
/// runs. A `OnceLock` keeps `print_output` (~30 call sites) from threading an `OutputFormat`
/// through every command signature; it defaults to TOON if `main` never sets it (e.g. a unit test
/// calling a command helper directly).
static OUTPUT_FORMAT: = new;
/// Set the global output format. Called once from `main` from the parsed `--json` flag; a second
/// call is a no-op (`OnceLock::set` returns `Err`), so tests can't accidentally clobber it.
pub
/// The format `print_output` renders in — TOON unless `main` set JSON from `--json`.
pub