Skip to content

Show default value of --fields - #161

Merged
digizeph merged 3 commits into
bgpkit:mainfrom
jmuecke:cli-fields-help-default
Nov 3, 2026
Merged

digizeph merged 3 commits into
bgpkit:mainfrom
jmuecke:cli-fields-help-default

Conversation

@jmuecke

@jmuecke jmuecke commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Closes #159.

Improvements:

  • same default format as other arguments
  • includes information on difference of JSON output in the default text
  • order (prior nit) included as fields as listed due line length limitation

digizeph and others added 3 commits November 3, 2026 06:00
`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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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, and watch, 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

@digizeph
digizeph merged commit 2cf8da3 into bgpkit:main Nov 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

monocle search should specify the default value of --fields in --help

3 participants