fj --version prints the ASCII brand mark even when piped, breaking version parsing in scripts #105
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observation
fj --versionprints the 15-line ASCII brand mark to stdout even when output is piped or redirected, so the version string is buried under decoration that scripts have to strip.This is not an oversight; it is a deliberate branch that contradicts the stated goal a few lines above it. The doc-comment on
handle_parse_outcome(src/main.rs:66-70) says:But the implementation only honors that for help, not version (
src/main.rs:75-85):So
fj --help | catis clean (gated onis_terminal()), butfj --version | catis not. The two paths disagree, and the version path is the one that loses.Why it matters
--versionis the single most script-consumed flag a CLI has: CI provenance logs, bug-report templates,tool --version || installguards, and agent self-checks all parse it.git --versionandgh --versioneach emit exactly one line. A team wiringfj --versioninto a pipeline gets 16 lines with the real datum last and a leading blank, so naive parsers (head -1,cut -d' ' -f2) capture whitespace or art instead of0.2.0. It is a first-contact paper cut precisely because version-probing is often the very first programmatic call a new adopter makes against the binary.Possible directions (sketches)
DisplayVersiononstd::io::stdout().is_terminal()exactly likeDisplayHelpalready is (src/main.rs:80-83), so an interactivefj --versionstill wears the mark but a piped one emits justfj 0.2.0.--versionis worth keeping, print the logo to stderr and the version line to stdout, so redirection of stdout stays clean while the terminal still gets brand.fj --versionwith a non-tty stdout produces a single line matching^fj \d+\.\d+\.\d+$, mirroring whatever covers the piped-help case.Confidence
High. Behavior reproduced (
fj --version | wc -l= 16). The contradiction is in one function: the doc-comment promising piped-clean version output (src/main.rs:66-70) versusErrorKind::DisplayVersion => true(src/main.rs:78), with the adjacent help branch (src/main.rs:80-83) showing the intendedis_terminal()gate already applied elsewhere. The remaining choice (suppress vs. route to stderr on a tty) is a product call, not a question of fact.Converted to backlog item
rasterstate/fj#115(p3, size S).Tracked there with task / priority / reason / acceptance / dependencies. Keeping this open with the
convertedlabel as the originating opportunity.Derived backlog item rasterstate/fj#115 is merged. Closing this opportunity per the issue state machine.