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

Please support a feature to omit all help and messages #1384

Closed
joshtriplett opened this issue Nov 18, 2018 · 7 comments · Fixed by #4236
Closed

Please support a feature to omit all help and messages #1384

joshtriplett opened this issue Nov 18, 2018 · 7 comments · Fixed by #4236
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing

Comments

@joshtriplett
Copy link
Contributor

joshtriplett commented Nov 18, 2018

For the purposes of reducing binary size, I'd love to have a new default feature flag for clap (that projects could then disable) that would omit generated --help and all friendly error/constraint messages, and minimize error reporting to just "Invalid arguments" or similar. That would help for embedded use cases that may want to reduce the sizes of binaries used in scripting, without regard to human invocations of those binaries.

@CreepySkeleton
Copy link
Contributor

Related to #1485

@CreepySkeleton CreepySkeleton added A-help Area: documentation, including docs.rs, readme, examples, etc... C: other labels Feb 1, 2020
@CreepySkeleton
Copy link
Contributor

Closing in favor of #1365

@Dylan-DPC-zz
Copy link

This may be a side effect of that but not directly related. Reopening

@Dylan-DPC-zz Dylan-DPC-zz reopened this Feb 1, 2020
@pksunkara pksunkara added this to the 3.1 milestone Feb 1, 2020
@pksunkara pksunkara modified the milestones: 3.1, 3.0 Oct 13, 2020
@Rua
Copy link

Rua commented Jan 21, 2021

I would like this as well, but supported as a runtime option instead of a feature flag, so that it can be enabled or disabled on a case-by-case basis.

@ldm0
Copy link
Member

ldm0 commented Jan 28, 2021

I would like this as well, but supported as a runtime option instead of a feature flag, so that it can be enabled or disabled on a case-by-case basis.

@Rua This issue is mainly about reducing binary size. If you just wanna control the help message emission in the runtime, the right-now approach is using try_get_matches to get a result and control the output by yourself.

@ldm0 ldm0 self-assigned this Mar 13, 2021
@pksunkara pksunkara removed this from the 3.0 milestone Jun 16, 2021
@pksunkara
Copy link
Member

Postponing this for later than 3.0 because we need design on how to divided the existing help, error messages, usage etc.. into separate feature flags.

@epage
Copy link
Member

epage commented Dec 9, 2021

#2914 would unblock code-generating a display-agnostic(wrapping, styling) help message

So breaking this down, parts we can trim down

The main question I have is how should we divide this up among feature flags without overwhelming people (with too many flags). For example, a user could want to provide codegenned formatted help but still get all of the other nice features. Next would be the bike shedding over the names.

To get the conversation started, I'll start with

  • helpgen
    • Without App::override_help, no --help flag is generated
  • detailed-errors
    • includes smart usage, people have to disable helpgen to get rid of smart usage

With that said, how we divide things up I think depends partly on the cost of each feature. For example, if smart usage is more expensive, then maybe that should be broken out into its own feature flag. Or if detailed errors isn't too expensive, maybe we don't provide it. So I am assuming whatever decision we come up is a guideline and the implementer would need to measure the results and adapt accordingly.

@epage epage added S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing and removed P1: urgent labels Dec 9, 2021
epage added a commit to epage/clap that referenced this issue Aug 24, 2022
For now, there isn't much a custom implementation can do.

Going from `Rich` to `Null` drops about 6 KiB from the binary

This is a part of clap-rs#1365 and clap-rs#1384
epage added a commit to epage/clap that referenced this issue Aug 24, 2022
For now, there isn't much a custom implementation can do.

Going from `Rich` to `Null` drops about 6 KiB from the binary

This is a part of clap-rs#1365 and clap-rs#1384
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-enhancement Category: Raise on the bar on expectations S-waiting-on-design Status: Waiting on user-facing design to be resolved before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants