Commit graph

6182 commits

Author SHA1 Message Date
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
Ed Page
d6d838ebe2 feat: Allow stylized usage 2022-08-25 17:07:06 -05: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
Ed Page
735d6fd1e3 refactor: Extract our own display width
This added about 4 KiB to `.text` which makes sense since we duplicated
logic.
2022-08-24 18:19:03 -05:00
Ed Page
c6155f62d5 feat: Open the door for user styling in the future
This added about 10 KiB to the `.text` which I cannot explain why
2022-08-24 18:17:42 -05:00
Ed Page
d219c69c51
Merge pull request #4111 from epage/error
perf(error): Allow custmizing formatting
2022-08-24 12:57:38 -05:00
Ed Page
ef5f9f956a perf(error): Allow custmizing formatting
For now, there isn't much a custom implementation can do.

Going from `Rich` to `Null` drops about 6 KiB from the binary

This is a part of #1365 and #1384
2022-08-24 12:40:21 -05:00
Ed Page
d16a531e54 feat(error): Expose context lookup 2022-08-24 11:12:13 -05:00
Ed Page
ba5a4bc6d4 refactor(error): Switch Vec to FlatMap
Looks like this dropped 2 KiB
2022-08-24 11:10:41 -05:00
Ed Page
956789c39f
Merge pull request #4110 from epage/styled
refactor(help): Prepare for user-visible styled string
2022-08-24 11:02:25 -05:00
Ed Page
3672663319 refactor(error): Delay colorizing until the end
This is prep for creating a formatter trait to select alternative
implementations for errors.
2022-08-24 11:00:20 -05:00
Ed Page
74f29fc52d refactor: Remove inline(never) that don't change anything 2022-08-24 09:21:39 -05:00
Peter Grayson
a0b1a03877
docs: Apply review suggestions for #4106 2022-08-24 10:03:25 -04:00
Ed Page
79bdeb266a
Merge pull request #4082 from Calder-Ty/bugfix/3861
fix: Show possible values in generated man file
2022-08-24 08:31:29 -05:00
Tyler Calder
a55db43758 fix: Add possible vals to man for positional args
Noticed that possible values would not show up for Positional arguments
as well. Decided to add the changes for those as well.
2022-08-23 22:03:37 -06:00
Tyler Calder
069098cfcb fix: Use roff bullet lists for possible_values 2022-08-23 21:54:46 -06:00
Tyler Calder
ec518e4819 fix: Take in account possible values being hidden
This makes sure we take into account the setting that possible args
is hidden
2022-08-23 21:47:17 -06:00
Tyler Calder
6342802f55 fix: Show possible values in generated man file
This adds feature parity for mangen with the standard help output. Users
will now see the list of possible values for value arguments.

One change that was made to make this possible was adding the method
`get_possible_values` to the public API for an arg. I tried to think of
a way to get around this, but because this is the interface that the
help generation uses, and it is part of the crate public interface
I thing adding it as a part of the public API might be for the best.

fixes: #3861
2022-08-23 21:47:17 -06:00
Ed Page
b0cac0845e refactor(help): Pull out a StyledStr
This is prep for making it public
2022-08-23 17:05:55 -05:00
Ed Page
81d57a0cd4 refactor(help): Simplify writing
The performance gains of writing directly to the writer are not worth
the complexity.  Output is not in our performance hot path.

Binary size went from 565.7 KiB to 562.2 KiB
2022-08-23 16:49:46 -05:00
Ed Page
d4ec9ca54f
Merge pull request #4107 from epage/help
fix: Don't pollute root with str types
2022-08-23 13:24:45 -05:00
Ed Page
276c75cc08 fix: Don't pollute root with str types 2022-08-23 13:12:06 -05:00