Commit graph

7739 commits

Author SHA1 Message Date
Sean Allred
05cd057978
perf: Avoid retrieving possible_values unless used
In some sophisticated situations, these may be expensive to calculate.
One example might be a '--branch' option accepting any single Git
branch that exists on the remote -- in such a case, the remote would
need to be queried for all possible_values. The cost is ultimately
unavoidable at runtime since this validation has to happen eventually,
but there's no need to pay it when generating help text if
`is_hide_possible_values_set`.

To keep '-h' fast, avoid collecting `possible_values` during '-h'
unless we're actually going to use the values in display.

This optimization is repeated for the manpage renderer.

This is trivially based on the short-circuiting logic at [1], which at
least supports the idea that actually consuming the iterator is not
generally-guaranteed behavior when `hide_possible_values` is set.

Note on the 'expensive' mod: This keeps all the possible_values tests
in one file but allows the entire set of tests to be controlled by the
'strings' feature (which is required to be able to use String rather
than str for each possible value).

[1]: clap_builder/src/builder/command.rs:long_help_exists_
2023-12-28 10:06:35 -06:00
Ed Page
29208083b0 test: Update snapshots 2023-12-27 12:09:15 -06:00
Ed Page
28763ebb6d chore: Release 2023-12-27 11:58:25 -06:00
Ed Page
ace7bb5b45 docs(complete): Update changelog 2023-12-27 11:58:12 -06:00
Ed Page
76beca4d4d docs(complete): Polish API reference for dynamic 2023-12-27 11:57:38 -06:00
Ed Page
3630e582d3
Merge pull request #5273 from epage/docsrs
docs: Include more content on docs.rs
2023-12-27 11:47:04 -06:00
Ed Page
3724b9e2e4 docs: Include more content on docs.rs 2023-12-27 11:30:42 -06:00
Ed Page
d092896d61 chore: Release 2023-12-04 12:17:32 -06:00
Ed Page
c76a713f8b chore: Update lockfile 2023-12-04 12:17:20 -06:00
Ed Page
b99d17bb0b docs: Update changelog 2023-12-04 12:16:15 -06:00
Ed Page
b47f8da4d8
Merge pull request #5247 from epage/group
feat: Add Command::mut_group
2023-12-04 12:15:32 -06:00
Ed Page
2e7c9d11a8
Merge pull request #5194 from c19/patch-1
proc-macro2 bump to 1.0.69 to fix unknown feature proc_macro_span_shrink
2023-12-04 12:07:56 -06:00
Ed Page
37917be0b7 feat: Add Command::mut_group
Fixes #5038
2023-12-04 12:03:05 -06:00
Ed Page
cf7a0272cc chore: Update from '_rust/main' 2023-12-04 11:05:47 -06:00
Ed Page
8c836eaa9d
Merge pull request #10 from epage/renovate/migrate-config
chore(config): migrate renovate config
2023-12-04 10:10:34 -06:00
renovate[bot]
598c624498 chore(config): migrate config .github/renovate.json5 2023-12-03 09:19:35 +00:00
Ed Page
c0a1814d3c chore: Release 2023-11-27 21:20:50 -06:00
Ed Page
c83e681e20 docs: Update changelog 2023-11-27 21:20:34 -06:00
Ed Page
91bcac4ca9
Merge pull request #5230 from epage/migrate
docs: Link out to the changelog at the relevant tag
2023-11-27 21:19:51 -06:00
Ed Page
030d87505d docs: Link out to the changelog at the relevant tag
This was inspired by #4254
2023-11-27 16:54:58 -06:00
Ed Page
b661a9de04
Merge pull request #5229 from epage/derive
docs(derive): Link to tutorial sections for attributes
2023-11-27 16:31:35 -06:00
Ed Page
a08587b00e docs(derive): Link to tutorial sections for attributes
This is part of #5199
2023-11-27 16:16:54 -06:00
Ed Page
21b671f689 chore: Release 2023-11-27 11:57:26 -06:00
Ed Page
93ba76dbaa docs: Update changelog 2023-11-27 11:56:46 -06:00
Ed Page
c1c55b30d8
Merge pull request #5228 from epage/flat
fix(help): Hide subcommands in flattened usage
2023-11-27 10:58:41 -06:00
Ed Page
b13f6d9862 fix(help): Hide 'help' if only flattened subcommand 2023-11-27 10:49:21 -06:00
Ed Page
a9322cabf3 fix(help): Hide subcommands in flattened usage 2023-11-27 10:43:16 -06:00
Ed Page
b6561983a0 test(help): Show how hide and flatten mix 2023-11-27 10:38:05 -06:00
Ed Page
5c8f8d5f65
Merge pull request #5227 from epage/flat
fix(help): Use right about when flattening
2023-11-27 10:21:02 -06:00
Ed Page
22130e3057 fix(help): Use right about when flattening
Fixes #5226
2023-11-27 09:28:30 -06:00
Ed Page
e9194b55e2 test(help): Better show about bug 2023-11-27 09:23:38 -06:00
Ed Page
5c81df6855
Merge pull request #5216 from kellytk/correct-wording
Update command.rs
2023-11-17 11:29:32 -06:00
Kelly Thomas Kline
7568d5fa67
Update command.rs
Correct wording.
2023-11-16 21:06:03 -08:00
Ed Page
3aeea916e8 chore: Release 2023-11-10 16:24:46 -06:00
Ed Page
1add9a7ae4 docs: Update changelog 2023-11-10 16:24:23 -06:00
Ed Page
6b2a2ccb44
Merge pull request #5206 from epage/flatten
feat(help): Opt-in to flatten subcommands into parent command help
2023-11-10 16:21:52 -06:00
Ed Page
9c0f7a7253 fix(help): Recurse help flattening 2023-11-09 15:34:05 -06:00
Ed Page
4bef91ca3c refactor(help): Pull out flat subcommands 2023-11-09 15:34:03 -06:00
Ed Page
c9a7ef06e1 fix(help): Gloss over globals with flatten
When using globals, people tend to make all of the top-level arguments
global and cascading them through would just bloat the output.
2023-11-09 15:33:18 -06:00
Ed Page
9e5f93d43f fix(help): Be consistent in long/short help 2023-11-09 15:33:18 -06:00
Ed Page
66d2bcbdd4 feat(help): Allow flattening help 2023-11-09 15:32:57 -06:00
Ed Page
3383242b47
Merge pull request #5205 from epage/flatten-refactor
refavtor: Prepare for help flattening
2023-11-09 15:20:21 -06:00
Ed Page
caf5cdcfa0 feat(help): Allow flattening usage 2023-11-09 13:31:22 -06:00
Ed Page
a1fd922bda feat(help): Allow controlling flattening 2023-11-09 13:31:11 -06:00
Ed Page
2142b136b8 refactor: Pull out usage name fallback 2023-11-09 13:27:59 -06:00
Ed Page
4b60cefbf1 refactor: Pull out bin name fallback 2023-11-09 13:26:20 -06:00
Ed Page
a920a7fe8d
Merge pull request #5204 from epage/usage-refactor
refactor(help): Clean up the usage code
2023-11-09 13:18:05 -06:00
Ed Page
c1c2e95ab6 refactor(help): Pull out subcommand usage logic 2023-11-09 12:52:08 -06:00
Ed Page
d9685bcc71 refactor(help): Bypass outer usage layer 2023-11-09 12:52:08 -06:00
Ed Page
25e3a87d3c refactor(help): Consolidate arg line usage generation 2023-11-09 12:14:25 -06:00