Correct the README --json global-flag claim and lock it against drift #99

Closed
opened 2026-06-10 21:58:33 +00:00 by stephen · 0 comments
Owner

What

Fix README.md:177-178 so --json is no longer listed among the flags that "work on every command." Move it out of the global list and describe it as applying to data-returning commands (list/view/etc.), matching the accurate in-binary top-level help at src/cli/mod.rs:64. The genuinely global flags stay as listed (--host, --debug, --no-pager, --json-fields). Add a test that asserts the README "global flags" line stays in sync with the set of global = true args on the clap Cli struct (src/cli/mod.rs:82-99) so the doc and the code cannot drift apart again.

Why

rasterstate/fj#94: the README sells JSON output as a headline feature "so scripts and AI agents" can consume fj, and lists --json as a global flag, but only four flags are global = true; --json is declared per-subcommand, so fj auth status --json fails with "unexpected argument '--json' found." Scripters and agents are exactly the audience that reads "works on every command" literally and builds it into a wrapper, turning a marquee selling point into a first-contact trust paper cut. The in-binary help is already correct, so this is a verified doc-vs-code contradiction with a real user-facing error, fixed by correcting the doc rather than changing behavior.

Acceptance

  • README no longer claims --json is global; it documents --json as applying to data-returning commands (list/view/etc.).
  • A test fails if the README "global flags" list and the set of global = true args in Cli diverge.
  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all pass.

Dependencies

none

Out of scope

  • Promoting --json to a real global flag (the larger alternative direction); this item fixes the doc to match current behavior rather than changing behavior.
  • Reworking --json-fields or the JSON output format.

Size

S

## What Fix `README.md:177-178` so `--json` is no longer listed among the flags that "work on every command." Move it out of the global list and describe it as applying to data-returning commands (list/view/etc.), matching the accurate in-binary top-level help at `src/cli/mod.rs:64`. The genuinely global flags stay as listed (`--host`, `--debug`, `--no-pager`, `--json-fields`). Add a test that asserts the README "global flags" line stays in sync with the set of `global = true` args on the clap `Cli` struct (`src/cli/mod.rs:82-99`) so the doc and the code cannot drift apart again. ## Why rasterstate/fj#94: the README sells JSON output as a headline feature "so scripts and AI agents" can consume `fj`, and lists `--json` as a global flag, but only four flags are `global = true`; `--json` is declared per-subcommand, so `fj auth status --json` fails with "unexpected argument '--json' found." Scripters and agents are exactly the audience that reads "works on every command" literally and builds it into a wrapper, turning a marquee selling point into a first-contact trust paper cut. The in-binary help is already correct, so this is a verified doc-vs-code contradiction with a real user-facing error, fixed by correcting the doc rather than changing behavior. ## Acceptance - [ ] README no longer claims `--json` is global; it documents `--json` as applying to data-returning commands (list/view/etc.). - [ ] A test fails if the README "global flags" list and the set of `global = true` args in `Cli` diverge. - [ ] `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all` pass. ## Dependencies none ## Out of scope - Promoting `--json` to a real global flag (the larger alternative direction); this item fixes the doc to match current behavior rather than changing behavior. - Reworking `--json-fields` or the JSON output format. ## Size S
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#99
No description provided.