Repository navigation
Show default value of --fields - #161
Merged
Merged
Conversation
`parse`, `search`, and `watch` accept `--fields` but the help never said
which fields are printed when the option is omitted. The default is
rendered as a delta against the available fields ("all fields except ...")
because clap does not wrap help text, so repeating the default list would
add a several-hundred-character line to `--help`.
`watch --fields` now lists the available fields as well, since it shares
the parse defaults.
`parse` and `watch` emit the native element fields for JSON output when the default field set is selected, so the default line alone was inaccurate for those two commands. `search` projects the field list, so its help is unchanged.
We use `fields as listed` to include that the above order is considered while including the different behavior for JSON output and maintaining 120 line length.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the changes documenting command-specific --fields defaults.
No open issues 🎉
What changed in this PR
Addresses #159 by documenting command-specific --fields defaults in CLI help, making output fields and their order clearer without changing runtime behavior.
Changes:
- Adds default-field summaries for
parse,search, andwatch, including the native JSON output distinction. - Adds tests for help text, summary length, and default-field validity.
- Updates README help examples to match.
| File | Description |
|---|---|
src/bin/commands/watch.rs |
Adds field availability and default information to watch help. |
src/bin/commands/search.rs |
Displays search-specific field defaults. |
src/bin/commands/parse.rs |
Displays parse-specific defaults and the JSON distinction. |
src/bin/commands/elem_format.rs |
Generates shared default summaries and adds tests. |
README.md |
Refreshes parse and search help examples. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #159.
Improvements:
fields as listeddue line length limitation