Commit graph

6201 commits

Author SHA1 Message Date
Andrew Shu
eec047a6f6 fix(help): Do not propagate global args to help
This prevents global args from showing in help completions,
since help completions should only suggest subcommands.
Adds tests to ensure the args still show in the generated
help messages of subcommands.
2022-08-26 17:48:58 -07:00
Ed Page
1f3df00388
Merge pull request #4130 from epage/structopt
fix(derive): Remove structopt attribute support
2022-08-26 16:23:07 -05:00
Ed Page
ba5eec31f5
Merge pull request #4129 from epage/derive
refactor(derive): Prepare for builder attributes
2022-08-26 16:08:31 -05:00
Ed Page
521a012c28 fix(derive): Remove structopt attribute support 2022-08-26 16:06:10 -05:00
Ed Page
c04fe2fa4b refactor(derive): Allow carrying context with parsed attributes 2022-08-26 15:52:21 -05:00
Ed Page
294868f5d8
Merge pull request #4115 from talklittle/completion-help-parser-flag
feat(complete): Add completion for help subcommands
2022-08-26 15:28:21 -05:00
Andrew Shu
0d0be51606 fix(complete): Fix help completion issues
* Copy hide flag

* Revert global args special handling. Another commit will
address the issue of whether global args should be included in
help subtrees.
2022-08-26 12:57:12 -07:00
Ed Page
f08575e4a3 refactor(derive): Simplify verbatim docs tracking 2022-08-26 14:44:04 -05:00
Ed Page
2f4e42f227
Merge pull request #4128 from epage/default
fix(derive): Remove error case for default_value
2022-08-26 14:16:10 -05:00
Ed Page
4e6733fbe5 fix(derive): Remove error case for default_value 2022-08-26 13:59:18 -05:00
Ed Page
c13b824e37
Merge pull request #4127 from epage/arg
fix(derive): Remove deprecated arg_enum attribute
2022-08-26 13:48:47 -05:00
Ed Page
b4b121d3a4 fix(derive): Remove deprecated arg_enum attribute 2022-08-26 13:34:16 -05:00
Ed Page
6523666a73
Merge pull request #4126 from epage/dimmed
fix(help): Don't dim placeholders
2022-08-26 11:58:27 -05:00
Ed Page
e02648e66b fix(help): Don't dim placeholders
This came from feedback: https://rust-lang.zulipchat.com/#narrow/stream/220302-wg-cli/topic/Help.20changes.20in.20clap.20v4
2022-08-26 11:46:44 -05:00
Ed Page
7818af3ac8
Merge pull request #4125 from epage/sub
fix(help): Shift focus to subcommands, when present
2022-08-26 11:13:27 -05:00
Ed Page
83d6add9aa fix(help): Shift focus to subcommands, when present
In surveying various tools and CLI parsers, I noticed they list the
subcommands first.  This puts an emphasis on them which makes sense
because that is most likely what an end user is supposed to pass in
next.

Listing them last aligns with the usage order but it probably doesn't
outweigh the value of getting a user moving forward.
2022-08-26 10:59:40 -05:00
Ed Page
aacb5620f1
Merge pull request #4123 from epage/header-help
fix(help): Don't rely on ALL CAPS for headers
2022-08-26 10:41:22 -05:00
Ed Page
9b23a09f7a fix(help): Don't rely on ALL CAPS for headers
I see them fulfilling two roles
- A form of bolding
- As a callback to their placeholder in usage

However, it is a bit of an unpolished look and no other CLI seems to do
it.  This looks a bit more proefessional.  We have colored help for
formatting and I think the sections relation to usage will be clear
enough.
2022-08-26 10:21:18 -05:00
Ed Page
1682649836
Merge pull request #4119 from epage/usage
fix(error): Don't underline indentation
2022-08-26 07:44:09 -05:00
Ed Page
b1e3dad190
Merge pull request #4118 from miguelff/master
Fix abort message when deriving non-unit enum variants
2022-08-26 07:26:39 -05:00
Ed Page
8315ba3dd6 fix(error): Don't underline indentation 2022-08-26 07:15:57 -05:00
Miguel Fernandez
42cb87b4b6 fix: Amend error message when deriving enums
Clarify that only unit variants are fully supported, and that
non-unit variants must be skipped.
2022-08-26 11:08:39 +02:00
Ed Page
c2ce1dd6f5
Merge pull request #4117 from epage/styled-help
fix(help): Use a more neutral palette
2022-08-25 19:50:01 -05:00
Ed Page
a6cb2e65bc
Merge pull request #4116 from epage/usage
feat: Allow stylized usage
2022-08-25 19:35:12 -05:00
Ed Page
6079a871a0 fix(help): Use a more neutral palette
Fixes #2963
2022-08-25 19:23:52 -05:00
Andrew Shu
729406661c refactor(complete): Clean up help completion
* Manual subtree copy to ensure correct behavior and settings
* Always set ExpandHelpSubcommandTrees in Command::build
* Remove redundant logic
2022-08-25 15:43:27 -07:00
Ed Page
d6d838ebe2 feat: Allow stylized usage 2022-08-25 17:07:06 -05:00
Andrew Shu
fdcee9313f feat(complete): Add completion for help subcommands
Adds parser flags to toggle whether to run the
expensive clone logic for completions case.

Help completion will only suggest subcommands, not args.

clap_complete generator sets the flag.
2022-08-25 13:58:08 -07:00
Ed Page
f2e5b0670a
Merge pull request #4114 from epage/wrap
feat(help): Open the door for user styling in the future
2022-08-25 13:59:30 -05:00
Ed Page
8382675985 style: Fix a typo 2022-08-25 13:45:36 -05:00
Ed Page
81f29d29ad refactor(help): Top-down sort functions 2022-08-25 13:39:21 -05:00
Ed Page
0c2f20d660 refactor(help): Drop the parser macro 2022-08-25 13:32:08 -05:00
Ed Page
207bb00453 refactor(help): Simplify several parts 2022-08-25 13:26:21 -05:00
Ed Page
d652f0348d refactor(help): Reduce a fn's visibility 2022-08-25 13:15:20 -05:00
Ed Page
df7616b820 fix(help): Match v3 usage for optional positionals 2022-08-25 13:13:09 -05:00
Ed Page
0e0c5eb218 refactor(help): Consolidate value printing 2022-08-25 13:07:32 -05:00
Ed Page
e00abc6905 refactor(help): Consolidate arg suffix rendering
This ended up favoring the help implementation
2022-08-25 13:01:27 -05:00
Ed Page
8607695ed9 refactor(help): Simplify the code
While this doesn't reduce size, it cleans things up to make it easier
2022-08-25 12:47:52 -05:00
Ed Page
64753bbc7d refactor(help): Make spec value implementations more flexible 2022-08-25 11:54:34 -05:00
Ed Page
06c40b636e refactor(help): Clarify arg separator 2022-08-25 11:33:21 -05:00
Ed Page
2dd493a295 perf(help): Reduce code size for arg generation 2022-08-25 11:29:23 -05:00
Ed Page
0a15d9ad0c refactor(help): Clarify intent 2022-08-25 11:01:03 -05:00
Ed Page
2d5b3263c5 feat: Allow styling of rest of StyledStr help 2022-08-25 10:39:39 -05:00
Ed Page
764ec6903b feat: Allow stylized arg helps
This adds about 5 KiB to `.text`
2022-08-25 10:18:41 -05:00
Ed Page
c228c88309 perf(help): Prefer small binary to speed 2022-08-25 09:54:58 -05:00
Ed Page
5e1d2d349b fix(debug): Reduce noise 2022-08-25 09:54:11 -05:00
Ed Page
c2e80beed2 fix(help): Allow stylized help template 2022-08-25 09:53:24 -05:00
Ed Page
1bd9365bdf perf(help): Reduce binary size
This dropped us about 1.8 KiB
2022-08-25 09:51:41 -05:00
Ed Page
37f2efb0bd perf: Vendor textwrap parts we need
The immediate benefit is binary size but this also makes us more
flexible on the implementation, like allowing wrapping of `StyledStr`.

This removed 12 KiB from `.text`

This helps towards #1365 and probably #2037
2022-08-25 09:50:54 -05:00
Ed Page
2e2b63fa5c
Merge pull request #4106 from jpgrayson/doc-override-usage
docs: overriding multi-line usage
2022-08-25 06:19:54 -05:00