Emit a single parseable line for piped fj --version #115
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?
Task
Make piped
fj --versionemit a single parseable line. GateErrorKind::DisplayVersiononstd::io::stdout().is_terminal()exactly like the adjacentDisplayHelpbranch already is (src/main.rs), so an interactivefj --versionstill wears the brand mark but a piped/redirected one emits justfj 0.2.0. (Alternative, if the mark on interactive--versionis worth keeping: print the logo to stderr and the version line to stdout.)Add a test asserting
fj --versionwith a non-tty stdout produces a single line matching^fj \d+\.\d+\.\d+$, mirroring the piped-help coverage.Source:
rasterstate/fj#105.Priority
p3. A first-contact paper cut: version-probing is often the very first programmatic call a new adopter or agent makes (CI provenance,
tool --version || installguards, self-checks), andfj --version | head -1returns a blank line instead of the datum. Real scripting-reliability value, but trivially worked around (tail -1) and low-frequency, so it sits below the structural gaps.Reason
The doc-comment on
handle_parse_outcome(src/main.rs) promises piped-clean--version/--help, but the implementation honors it only for help:ErrorKind::DisplayVersion => truealways prints the 15-line mark, whileDisplayHelpis gated onis_terminal(). Sofj --help | catis clean butfj --version | catis 16 lines with the real datum last and a leading blank.git --versionandgh --versioneach emit exactly one line.Acceptance
fj --versionpiped/redirected (non-tty stdout) emits exactly one line matching^fj \d+\.\d+\.\d+$.fj --versionon an interactive tty keeps the brand mark (or routes it to stderr, decision recorded).handle_parse_outcomedoc-comment matches the implemented behavior.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --allpass.Dependencies
None. Self-contained one-function change in
src/main.rsplus a test.Size
S
fj --versionprints the ASCII brand mark even when piped, breaking version parsing in scripts #105