-
-
Notifications
You must be signed in to change notification settings - Fork 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
Short/long help distinction seems unclear to the end-user #1015
Comments
True, but then again they might do the same thing. Programs that opt in to differences (via I do believe this should be marked as a documentation issue. |
Oh huh, I'd never noticed that in ripgrep; thanks for the tip.
Okay. |
Is it reasonable for clap to split up I think much of the problem is that they're presented as |
It turns out that `--help` provides a longer version of the help text than `-h` does. I only discovered that because I was wondering what the difference between `clap::App::about()` and `clap::App::long_about()` was. There's clap-rs/clap#1015 for tracking it in clap, but let's clarify it ourselves for now by changing the help text for `-h/--help`.
Yes, they should absolutely be on separate lines if they do different things. The distinction between short and long help might make sense but putting |
For those that only want one or the other, #3405 might be a way of forcing it by having |
Thought it was interesting to see how some tools handle this $ rg -h
...
Use -h for short descriptions and --help for more details.
... $ rg --help
...
Use -h for short descriptions and --help for more details.
... $ bat -h
...
Note: `bat -h` prints a short and concise overview while `bat --help` gives all details. $ bat --help
...
Note: `bat -h` prints a short and concise overview while `bat --help` gives all details. What if we changed the help description for .help("Print this help message. Use `--help` for more detail")
.long_help("Print this help message.. Use `-h` for a summary") As kbknapp said earlier in this thread
Since then
I'm thinking that putting these hints in the description for help would be good enough at this point in time to resolve this. |
We could also auto-detect if long help is used. Unsure if we want to pay that runtime price though. |
In reviewing CLIs for clap-rs#4132, I found some were providing helps on `-h` vs `--help` and figured that could be built directly into clap. I had considered not making this hint automatic but I figured the overhead of checking if long exists wouldn't be too bad. The code exists (no binary size increase) and just a simple iteration is probably not too slow compared to everything else. Fixes clap-rs#1015
In reviewing CLIs for clap-rs#4132, I found some were providing helps on `-h` vs `--help` and figured that could be built directly into clap. I had considered not making this hint automatic but I figured the overhead of checking if long exists wouldn't be too bad. The code exists (no binary size increase) and just a simple iteration is probably not too slow compared to everything else. Fixes clap-rs#1015
I hit this issue when using I am used to CLI interface conventions where the long and short names of an option do the same thing. It would never occur to me that Personally I think that if two options do different things, they should have different short and long names. For example, one could have |
(Or maybe |
@gasche does
I found it odd at first as well but it isn't unique to clap. We are unlikely to remove support for it at this point due to compatibility within the applications that use it. We have made it configurable in 4.3.14, so applications can choose to switch to something else. We can explore changing the defaults though. However, the case for it would likely need to be strong due to the people relying on the current behavior. The current convention is entrenched enough that we are unlikely to change i |
This default help message, produced by
clap
version 2.25.1, seems tome to imply that
-h
and--help
do the same thing, when they don'tnecessarily. For
Arg
s defined with bothhelp
andlong_help
,--help
may provide much more information than-h
, but as far as Ican tell there is nothing to make the end-user aware of this, which
seems problematic to me.
The text was updated successfully, but these errors were encountered: