Skip to main content

Module cx

Module cx 

Source
Expand description

Runtime context: injected I/O, environment, and working directory.

Cx threads every side-effecting handle through command dispatch so the library is unit-testable: tests build a Cx over in-memory buffers and a fixed environment, run a command, then inspect what was written. The binary builds a Cx over real stdio and the process environment.

The stdout/stderr split is the spec §5 contract: navigation paths, JSON, and data-command results go to Cx::out; all human-facing text, prompts, logs, and errors go to Cx::err.

Structs§

Cx
The runtime context threaded through command dispatch.
Env
A snapshot of environment variables, injectable for testing.
SilentInput
An Input that always reports end-of-input (an empty line), so any prompt is auto-declined. Used by the TUI’s background jobs (issue #46), whose command paths pass force/no-switch flags and never actually prompt.
StdinInput
The production Input that reads from standard input.
Stream
A writable output stream (stdout or stderr) tagged with whether it is a TTY.

Traits§

Input
A source of interactive input lines (e.g. y/N confirmations), injectable for testing.