Skip to main content

Module display

Module display 

Source
Expand description

12.3: the display rule (the keys note, section 7). A recovery code is shown only to a person at a terminal: stdout and stdin are terminals, no known agent-harness marker is set, and the controlling terminal opens. It’s shown through the controlling terminal, after a key press, on the alternate screen, so nothing reaches stdout or stays in scrollback. On Windows there’s no alternate screen (the escapes are Unix-only), so the code stays in the console’s scrollback; init --help and the CHANGELOG say so.

Constants§

AGENT_MARKERS
Environment variables that agent harnesses set in the commands they run. Each is checked against its vendor’s documentation, cited here. A marker only makes the rule stricter; only whether it’s set (and not empty) is read. A best effort: it can only name harnesses someone has checked, so the key press is the guard that doesn’t depend on it.
REFUSAL
What the user is told when a code isn’t shown.

Functions§

ask_hidden
Ask on the controlling terminal for prompt and read the answer without echo (onboard’s confirmation of the last group).
marker_reason
The marker part of the rule, over an environment lookup (for tests).
refusal_reason
Why the rule doesn’t hold here, or None when it does.
show
Show code under the rule: ask for Enter first, then show it on the alternate screen, wait for Enter again, and leave it. Call only when refusal_reason is None. The answers are read without echo.