-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Default help grouping is confusing and unwanted #2807
Comments
I agree with this being v4. I have a few opinions on this and especially modernizing the help message formats but don't want to focus on it for v3. |
Please share these thoughts somewhere so we can all be ruminating on them. |
In thinking about this, I think my main problem is with the splitting of Options and Flags. If those were combined, I probably wouldn't care or notice a problem. EDIT: nevermind, that is what Unified is. I forgot it doesn't impact positional arguments. |
clap history time; the original splitting of flags and options was based on a And I've had quite a few consumers ping me about what is the difference between Having said all that I actually don't have strong feelings about this issue No matter what direction we ultimately decide on, I believe a setting should be My gut says I think the least churn option is the best for the short term just |
FYI I've updated the Issue with a more detailed description of why the current dichotomy falls flat:
My concerns for keeping the feature around, even if off-by-default:
Personally, I've only seen one person say they personally prefer it. It'd help me a lot to feel this is worth it if I understood why. How does this help? What problem do they feel it solves?
I've gone ahead and created #2847 to describe the issue. The challenge is the straightforward option (add support for help_heading to UnifiedHelpMessage) makes the name more of a misnomer, making its use even less clear to users. Maybe this less-than-ideal middle road is good enough for 3.0 and we fix this in 4.0.
I frequently forget what my incantation of clap settings are and end up "regressing" when creating a new CLI. As I'm not a new user, I'm also less likely to look through the "basic" docs to remember. In addition, my concern with solving through docs:
|
I 100% agree with the name being a misnomer. |
I don't really have any skin in this since I can disable it, but I'll add my voice and say that as someone who has been using CLI tools for a very long time, the dichotomy that Clap was drawing between "options" and "flags" made zero sense to me. In fact, it confused me. I had to go and look up what was meant, since "option" and "flag" are synonyms in my head. I do not think the current grouping should be the default in v3. Even if I understood the distinction being drawn, it's hard for me to imagine how it is a useful one. And I can't think of any tool that I use off the top of my head that draws this distinction in their help text. (And if it did, it would annoy me, because it doesn't seem like a useful way of categorizing flags from an end user's perspective.) |
Yeah this is the sentiment I was referring to, I've had more than a few people express similar thoughts. Even if the dichotomy made sense to me at inception, like I mentioned many of the benefits and reasons behind the original splitting have gone away over the years. Having ruminated on this for a bit more time I 100% agree the name is a misnomer. I would be all on board for a re-name, however doing so seems like nearly as much churn than just making this the default setting and removing all complexities around it. Therefore I think we go with making it the default behavior and removing this setting/complexities around the split with the assumption that This might turn out to be a decent undertaking at least in |
Agreed.
Instead of that, let's keep the current behaviour under the inverse setting
Later on after 3.0, I would want to add more groups to this setting like boolean toggle args, subcommand flag args etc... |
If people can use If we do want a |
Can't we say that with the default help too since we provide template? It's all about easier way of doing it instead of asking people to do extra work. Here they would need to categorise their args one by one.
You can't say that because it is currently a default behavior. In fact there were a few people who created issues around this behavior because they want it improved.
Feel free to suggest a name. If we should not distract ourselves with this, let's do this as part of v4 then as @kbknapp proposed.
It would work with
This is about inverting the option and making the current behavior still be available to users. If we can't do that right now, let's fix this issue in v4 then. I don't mind. All I am asking is not to remove the current behavior. |
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
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
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
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
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
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
Rust Version
1.55.0
Affected Version of clap
v3.0.0-beta.4
Expected Behavior Summary
Args would be in a shared group by default
Actual Behavior Summary
Args are split up by their type (flags, arguments, positional)
Context
UnifiedHelpMessage
is a very popular flag to turn on. When further researching this, only tools using clap's defaults have this styling.One thing to keep in mind is ideally people can use
help_heading
out of the gate (see #2847). This is why I recommend we removeUnifiedHelpMessage
and the default help headings, giving us the behavior ofUnifiedHelpMessage
while also allowinghelp_heading
to be used by default.Going into more detail for why we should unify the approaches:
Problems with the default
help_heading
andDeriveDisplayOrder
are other examples of organizing--help
around the users task. Even sorting alphabetically is an okay-ish fallback when explicit organization falls flat because someone can scan for arguments that start with a letter for a word related to their task ("I need to see files, let's scan for--f
"), seerg
(which fails frequently for me...). Once I find the argument, I then care about how to use it (did they use a flag or an option with an enum and what are the values).--color[=<when>]
Problems with
UnifiedHelpMessage
help_heading
(Usinghelp_heading
in one place requires using it on all Flags to get a Unified experience #2847) and making it do so makes the name even more of a misnomerhelp_heading
which suggests something is off about the feature.The text was updated successfully, but these errors were encountered: