fix(json): rename --schema to --keys-only, closes #621#890
fix(json): rename --schema to --keys-only, closes #621#890FlorianBruniaux wants to merge 2 commits intodevelopfrom
Conversation
The previous --schema flag name implied output type rather than behavior. --keys-only is explicit: values are shown by default, this flag strips them. Closes #621 (json values now preserved by default; --keys-only is opt-in). Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Adds a one-liner listing all supported ecosystems (ruff, pytest, pip, golangci-lint, etc.) in the Architecture section to satisfy the pre-push documentation validation script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
There was a problem hiding this comment.
Pull request overview
Renames the rtk json CLI flag from --schema to --keys-only to better reflect that the mode shows JSON structure/keys only, while keeping values in the default output.
Changes:
- Renamed
rtk json --schematortk json --keys-onlyin Clap CLI wiring. - Updated inline CLI/help documentation strings describing
rtk jsonbehavior. - Added a short “Supported ecosystems” note to
CLAUDE.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main.rs | Renames the json subcommand flag field from schema to keys_only and forwards it into json_cmd. |
| src/cmds/system/json_cmd.rs | Updates run() doc comment to reference --keys-only. |
| CLAUDE.md | Documents supported ecosystems for contributors/agents. |
| depth: usize, | ||
| /// Show structure only (strip all values) | ||
| /// Show keys only (strip all values, show structure) | ||
| #[arg(long)] |
There was a problem hiding this comment.
Renaming the user-facing flag from --schema to --keys-only is a breaking CLI change (existing scripts/aliases will stop working). Consider adding a clap alias for backwards compatibility (and optionally deprecating it in help output) so both flags work for a transition period.
| #[arg(long)] | |
| #[arg(long, alias = "schema")] |
| /// Show JSON (compact values by default, or keys-only with --keys-only) | ||
| Json { | ||
| /// JSON file | ||
| file: PathBuf, | ||
| /// Max depth | ||
| #[arg(short, long, default_value = "5")] | ||
| depth: usize, | ||
| /// Show structure only (strip all values) | ||
| /// Show keys only (strip all values, show structure) | ||
| #[arg(long)] | ||
| schema: bool, | ||
| keys_only: bool, |
There was a problem hiding this comment.
This PR changes CLI parsing for rtk json (new --keys-only flag), but src/main.rs has clap parsing unit tests and none cover this flag. Add tests asserting rtk json <file> --keys-only parses (and, if you keep it, that the legacy --schema alias parses too / or errors as intended).
| /// Show JSON (compact with values by default, or keys-only with --keys-only) | ||
| pub fn run(file: &Path, max_depth: usize, schema_only: bool, verbose: u8) -> Result<()> { | ||
| validate_json_extension(file)?; |
There was a problem hiding this comment.
The module-level doc comment at the top of this file still states JSON is inspected "without showing values", but the current behavior/docs indicate values are shown by default (keys-only is opt-in). Update the module docs (and any referenced docs that still claim values are stripped by default) to avoid misleading users/contributors.
Summary
rtk json --schematortk json --keys-onlyschema_onlyparameter name is unchanged (private API)Context
Closes #621. The three signal truncation problems in that issue:
git diffmax hunk lines — already raised to 100 on develop (prior commits)git logbody lines — already at 3 non-empty lines on develop (prior commits)jsonvalues default — already preserved infilter_json_compact()(prior commits), but the opt-in flag was named--schemainstead of--keys-onlyThis PR addresses item 3: the flag name.
--keys-onlyis clearer than--schemabecause it names what the flag does (shows only keys) rather than what mode it enables.Before / After
Test plan
cargo test --all)cargo clippy --all-targets— 0 warningsrtk json --helpshows--keys-onlyflag🤖 Generated with Claude Code