You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 233e007
Browse filesBrowse the repository at this point in the historyBrowse files
Put narration on stderr and make the outcome codes combine (GH-13)
Four decisions the original boundary left implicit, taken now because all four
are free today and expensive later: Info has no callers, the exit numbers have
not shipped, and IsTTY has no call sites.
Table is now the only Writer method on stdout. Progress is narration, not the
product, and it must not land in the file when a user redirects stdout. In JSON
mode the cost was concrete: an info object carries none of the keys a data
object does, so jq -r .group yielded null for it. Every line on stdout is now a
data record, which the tests assert directly rather than by inspection. This
diverges from specs-cli, where commands already depend on Info being on stdout;
inheriting the defect to stay symmetrical was the wrong trade.
The outcome codes are disjoint bits that OR together, so a dry run that finds
drift and also cannot reach a repository exits 6 instead of forcing a
precedence rule that throws half the answer away. Skipped moves from 3 to 4 to
make room. Error stays outside the bit space and stays exclusive: when a run
fails the live state is unknown, so "failed and drifted" is not a statement
labelsync can honestly make — and with Error in the mask, 3 would have to mean
exactly that. The cost is that callers test bits rather than equality, which is
written down next to the table.
exit.Err carries a code out to main, because RunE returns an error and nothing
else. A nil Err field means silent: exit 2 on a drifting dry run must not print
an error line, because the drift was the successful result and the diff is
already on stdout. Unwrap is load-bearing — a carrier that hid the error it
wraps would strip error_kind from exactly the failures that carry a code — and
Of maps a carrier holding a failure to Error even when Code was left unset,
since a zero exit on a failed run is the one wrong answer a pipeline cannot
detect.
IsTTY takes any rather than an io.Writer. The prune guard has to ask about
stdin, and the old signature let IsTTY(os.Stdin) compile only because *os.File
happens to have a Write method. The two gated decisions ask about different
streams: the countdown about stderr, where it draws, and the prompt about
stdin, because the hang it prevents is a read with nobody to answer it.
The architecture page absorbs the reasoning that produced all of this, and
gains the Cobra wiring and review checklist that #14 has to follow.
0 commit comments