Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(help)!: Merge OPTIONS / FLAGS default groups #2867

Merged
merged 1 commit into from Oct 13, 2021
Merged

Conversation

epage
Copy link
Member

@epage epage commented Oct 12, 2021

For those that want the original behavior, you can usxe
arg.help_heading(Some("FLAGS")) on your flags. Limitations:

  • This will not give you a special sort order
  • This will not get a [FLAGS] added to usage
  • This will not allow {flags} template variable

For templates, we removed {unified} and {flags}. To help people
catch these, a debug_assert was added.

I'm unsure but I think there might be a change in behavior in calcuating
when to show [OPTION] in usage. The old code only looked at
required while flags looked only at arg groups. We now look at both.

Ideally we'd default help headings in _build and remove special casing for
no-groups except in the sort order of groups. I feel like thats best
left for later.

This also reduced the scope of Apps public API.
get_*_with_no_heading seemed a bit specialized to be in the public
API. #2853 looks at splitting it out into its own PR.

The most interesting changes are in

  • src/output/help.rs
  • src/output/usage.rs
  • src/build/app/debug_asserts.rs

Followed by

  • src/build/app/mod.rs
  • src/build/app/settings.rs

BREAKING CHANGE: Multiple

  • UnifiedHelpMessage removed
  • {flags} and {unified} are removed and will assert when present.
  • get_*_with_no_heading removed

Fixes #2807

src/build/app/mod.rs Outdated Show resolved Hide resolved
src/build/app/mod.rs Outdated Show resolved Hide resolved
src/build/arg/mod.rs Show resolved Hide resolved
src/output/help.rs Outdated Show resolved Hide resolved
src/output/help.rs Outdated Show resolved Hide resolved
tests/app_settings.rs Show resolved Hide resolved
tests/utils.rs Show resolved Hide resolved
tests/hidden_args.rs Outdated Show resolved Hide resolved
tests/help.rs Outdated Show resolved Hide resolved
tests/help.rs Outdated Show resolved Hide resolved
Copy link
Member

@pksunkara pksunkara left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

👎 Rejected by PR status

@pksunkara
Copy link
Member

Looks like a small rebase issue. Feel free to merge after replacing that setting

For those that want the original behavior, you can usxe
`arg.help_heading(Some("FLAGS"))` on your flags.  Limitations:
- This will not give you a special sort order
- This will not get a `[FLAGS]` added to usage

For templates, we removed `{unified}` and `{flags}`.  To help people
catch these, a debug_assert was added.

I'm unsure but I think there might be a change in behavior in calcuating
when to show `[OPTION]` in usage.  The old code only looked at
`required` while flags looked only at arg groups.  We now look at both.

Ideally we'd add these in `_build` and remove special casing for
no-groups except in the sort order of groups.  I feel like thats best
left for later.

This also reduced the scope of `App`s public API.
`get_*_with_no_heading` seemed a bit specialized to be in the public
API.  clap-rs#2853 looks at splitting it out into its own PR.

BREAKING CHANGE: Multiple
- `UnifiedHelpMessage` removed
- `{flags}` and `{unified}` are removed and will assert when present.
- `get_*_with_no_heading` removed

Fixes clap-rs#2807
@pksunkara
Copy link
Member

bors retry

@pksunkara
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 13, 2021

Build succeeded:

@bors bors bot merged commit c529697 into clap-rs:master Oct 13, 2021
@epage epage deleted the unified branch October 14, 2021 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants