Commit graph

6472 commits

Author SHA1 Message Date
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
Peter Grayson
bcd1062fdf
docs: How to override multi-line usage
Extend Command::override_usage() doc string to describe how to format
multiple usage lines to be compatible with clap's default help formatter.

Relates-to: #3413
2022-08-23 11:21:07 -04:00
Ed Page
c6b8a7bafc docs: Update changelog 2022-08-22 19:47:05 -05:00
Ed Page
a8523a0d0b
Merge pull request #4103 from epage/arg
fix: Switch to owned types
2022-08-22 16:48:15 -05:00
Ed Page
907941a565 style: Make clippy happy 2022-08-22 16:07:56 -05:00
Ed Page
c9d883a8c6 refactor: Remove once_cell dependency 2022-08-22 16:07:14 -05:00
Ed Page
fc499ac0ec perf: Let users choose Str implementation
The binary size and performance difference is enough to make it
configurable.

Code size:
- default: 565.7 KiB
- perf: 578.5 KiB

Build time:
- default: 9.1706 us
- perf: 7.0479 us

Parse time:
- default: 12.673 us
- perf: 8.1708 us

Parse with subcommand time:
- default: 12.112 us
- perf: 7.9874 us
2022-08-22 15:47:21 -05:00
Ed Page
71752f56ea perf: Switch Str to use Box<Str>
Impact:
- Binary size: 556.6 KiB to 578.4 KiB 565.3 KiB
- build time: 9.6393 us
- parse time: 12.616 us
- parse sc time: 12.745 us
2022-08-22 14:56:16 -05:00
Ed Page
931d0e1bff perf: Switch Str to use String
Impact
- Binary size: 556.6 KiB to 578.4 KiB to 574.6 KiB
- build time: 9.4581 us
- parse time: 13.055 us
- parse sc time: 13.384 us
2022-08-22 14:56:16 -05:00
Ed Page
9b9e57628d refactor: Make Id consts more universal 2022-08-22 14:56:16 -05:00
Ed Page
049d6794b5 refactor: Isolate str inner 2022-08-22 14:56:16 -05:00