-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-cli-helpArea: built-in command-line helpArea: built-in command-line help
Description
This is a tracking issue for figuring out how to make the output cargo $subcommand --help
more useable. We discussed this at the cargo team meeting today and a few ideas we had:
- Make unstable options only visible if you call it as
--help -Z unstable-options
. Hide unstable options from --help without -Z unstable-options #6102 - Make some lesser used flags only visible if you call it as
--help --verbose
- Organize flags into categories so that they are grouped together in the help output.
Other ideas appreciated! Also appreciated would be any PRs to make the wording of help output clearer or more concise.
Metadata
Metadata
Assignees
Labels
A-cli-helpArea: built-in command-line helpArea: built-in command-line help
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ehuss commentedon Sep 26, 2018
clap
currently supports the ability to have a short/verbose help by using-h
or--help
. Seeripgrep
as an example that makes extensive use of this. Personally I don't find that very obvious (I usually assume those two flags are the same), but it could help. Thoughts?clap
3.0 has some more options for controlling the help display.help_heading
can be used to aggregate related options (which would make the display longer, but would help separate unrelated options). There's alsodisplay_order
which exists in 2.x.I've been wanting to write more extensive documentation for each command, but I'm uncertain where it should live. I fear putting it in the
--help
text would contribute to making it overwhelming. However, putting it in the reference manual may make it hard to discover. This documentation would discuss more about what the command actually does, what the default target/profile selections are, usage examples, etc.alexcrichton commentedon Sep 27, 2018
I'm personally fond of
-h --verbose
vs-h
like what rustc does, which meakse-h
pretty usable by default and then we just dump everything else in--verbose
. I would also be wary of differentiating between-h
and--help
, I would also expect them to be the same!For more long-form documentation though I think using HTML docs is probably better, and I think we could also place urls to those documentation as well perhaps?
ehuss commentedon Sep 28, 2018
It's a bit tricky to do that in clap, but it should be possible. I can put together a prototype to see what it looks like.
Nemo157 commentedon Oct 3, 2018
Could also include those files with the cargo install and support something like
--help --open
to open them in a browser.alexcrichton commentedon Oct 3, 2018
Seems plausible to me!
ehuss commentedon Oct 4, 2018
@joshtriplett Here is the option grouping support in clap v3: https://github.com/clap-rs/clap/blob/eaa0700e7ed76f37d245a6878deb3b8e81754d6c/src/build/app/mod.rs#L645-L651 and what it looks like: https://github.com/clap-rs/clap/blob/eaa0700e7ed76f37d245a6878deb3b8e81754d6c/tests/help.rs#L1395-L1416
It's not clear to me what's going on with clap 3. It looks like there's a lot of good stuff, but there hasn't been much progress recently.
I looked at implementing
-h --verbose
, but I hit a roadblock (clap-rs/clap#1350), and I don't think it is possible at this time. We could hack in something (look at the args before clap parsing, and just print a hand-written document).pickfire commentedon Feb 22, 2020
I believe we should bold the
b
inbuild
for short alias for cargo subcommand and other subcommands to aid command discovery. Before I saw https://cheats.rs/#cargo, I am not aware ofcargo b
. (same goes fort
andr
andc
).pksunkara commentedon Apr 4, 2020
If you specify
alias
for the subcommand, the help message should automatically show you the alias. It will even work withInferSubcommands
turned on. We don't need to do thebold
proposed above.pickfire commentedon Apr 5, 2020
@pksunkara It removes the
alias
in the command, I don't know what is the reasoncargo/src/bin/cargo/commands/build.rs
Line 8 in 805462e
Show alias in help message
Auto merge of #8307 - pickfire:alias-help, r=alexcrichton
11 remaining items