Commit graph

57 commits

Author SHA1 Message Date
Yuri Astrakhan
d810235d07 chore: Minor code dedup for writing possible vals
* writing possible values and subcommands used nearly identical code
* writing elements used duplicate code once for items and once for last item
2023-05-03 18:40:44 -04:00
Ed Page
baaf5c64c1 chore: Release 2023-05-02 14:07:29 -05:00
Ed Page
937f1ed9c9 fix(parser): Update iterator sizes as we go
Maybe it was just me, but I didn't realize that the length had to be
updated as we went but it can cause panics with a bad message.

Fixes #4870
2023-05-02 13:53:42 -05:00
Ed Page
a7214540f6 chore: Release 2023-05-02 13:24:34 -05:00
Dillon Shaffer
37507741c4
impl Eq<std::any::TypeId> for clap_builder::util::AnyValueId 2023-05-01 08:40:00 -06:00
Ed Page
fa57ed3123 chore: Release 2023-04-27 04:29:47 -05:00
Ed Page
9eaf8996a4
Merge pull request #4867 from epage/panic
fix(builder): Assert earlier on bad requires/conflicts
2023-04-27 18:57:19 -05:00
Ed Page
185729a7dc fix(builder): Assert earlier on bad requires/conflicts
Fixes #4865
2023-04-27 04:16:14 -05:00
Ed Page
e02644b9c2 fix(usage): Provide more context in panic 2023-04-27 04:12:22 -05:00
mattmadeofpasta
296fec9186
test(help): Remove redundant test 2023-04-27 09:04:35 +00:00
Clement Tsang
89bf732353
docs: Update mut_arg docs on help + version flags 2023-04-20 22:18:27 -04:00
Ed Page
950a495753 fix(help): Preserve block indent when wrapping 2023-04-19 11:55:53 -05:00
Ed Page
4f0666d437 refactor(help): Clarify word splitter 2023-04-19 11:37:03 -05:00
Ed Page
60c8c3fc31 chore: Release 2023-04-19 11:11:47 -05:00
Ed Page
1ca073f212 docs(help): Fill in styles docs 2023-04-19 11:00:00 -05:00
Ed Page
6d5aaae5a9 feat(help): Allow access to current Styles 2023-04-19 10:57:00 -05:00
Ed Page
b99c50f7e9 chore: Release 2023-04-18 15:52:35 -05:00
Ed Page
cbea23e3fc style: Make clippy happy 2023-04-18 15:36:02 -05:00
Ed Page
5ca3b2fc5f refactor(help): Shrink binary size 2023-04-18 15:28:20 -05:00
Ed Page
ec7040e8ba style: Make clippy happy 2023-04-18 15:22:42 -05:00
Ed Page
57974bed7b refactor(help): Future proof styling
We can add a new style and default it to what it was split out of
without a breaking change.
2023-04-18 15:22:42 -05:00
Ed Page
e10e2ad249 refactor(help): Split out separate usage style
Because this doesn't have a full section after it, people might want to
style it differently than other headers.
2023-04-18 15:22:42 -05:00
Ed Page
8fd0a93bdc refactor(help): Clarify style meaning 2023-04-18 15:22:42 -05:00
Ed Page
7cf08e63cd refactor(help): Remove unused hint 2023-04-18 15:22:42 -05:00
Ed Page
015f88b21a feat(help): Allow customizing terminal styling
For now, this is behind the `unstable-styles` feature as we verify this
is what we want for #3224
2023-04-18 15:22:42 -05:00
Ed Page
3cb90b0b22 refactor(help): Use a stylesheet 2023-04-18 15:22:42 -05:00
Ed Page
72515d14b1 refactor(help): Style in the caller
Random fixes along the way
- In one case the space after `tip:` was "colored" (won't matter until
  themeing is available)
- One error case didn't color invalid values
- Changed the args associated with invalid values to be `literal` rather
  than `warning`
- Changed the required value count to be `good`
- Changed the arg for invalid value counts to be `literal` (the actual
  count is `warning`)
2023-04-18 15:22:42 -05:00
Ed Page
9416f3a347 refactor(help): Use anstyle in the caller 2023-04-18 15:22:42 -05:00
Ed Page
ab61cd6aaf refactor(help): Push color knowledge out a layer 2023-04-18 15:22:42 -05:00
Ed Page
c8f5afe9b5 refactor: Make anstyle always available 2023-04-18 15:22:42 -05:00
Ed Page
690ae13f57 refactor: Track term widths as plugins 2023-04-13 02:23:18 -05:00
Ed Page
1924f45289 refactor: Design plugin system 2023-04-13 01:18:44 -05:00
Ed Page
fe70ddcb20 refactor(builder): Move Any out of parser 2023-04-13 00:28:00 -05:00
Ed Page
6f409544ec chore: Release 2023-04-12 21:41:50 -05:00
Ed Page
9c85e1b295 chore: Update anstyle/anstream 2023-04-12 21:25:42 -05:00
Ed Page
feddd124b0 style: Move away from banned fns 2023-03-30 02:18:00 -05:00
Lorenzo
13d79b7677
Fix typo 2023-04-02 20:01:51 +09:00
Ed Page
3ef784b516 chore: Release 2023-03-28 13:30:03 -05:00
Ed Page
58615a1306 fix(error): Don't highlight 'similar' 2023-03-28 10:00:30 -05:00
Ed Page
8fc65e28b6 chore: Release 2023-03-28 02:19:08 -05:00
Ed Page
56fe5e0ec0 fix!: Remove unstable-replace feature flag
This has been implemented for 3 years without much traction for
finishing it up.

The subcommand use case can be worked around by creating `Command`s that
just include the relevant logic, very similar to the default subcommand
examples in `git` / `git-derive`.

Using this for flags is covered by #4793.

Without `unstable-replace` being enabled, this still cut 5 KiB from
`cargo bloat --release --example git`.

Closes #2836
Closes #2011
2023-03-28 00:26:45 -05:00
Ed Page
d5089b2672 fix!: Remove stablized unstable-grouped feature 2023-03-28 00:22:40 -05:00
Ed Page
fa60e723fc fix(error): Give more idea why we are suggesting an arg
One challenge with this is finding something that generally works.
Making this work perfectly for one setting will make it inconsistent
with other settings and take up more binary size / compile time.

So in the end, I felt like just mirroring rustc (with a bit more
brevity) seemed like a decent experiment.  This will be evaluated by the
feedback on release.

This is a small part of #4638
2023-03-27 20:45:27 -05:00
Ed Page
234d5f91d1 fix(error): Change from neutral 'note' to helpful 'tip'
This also has the advantage of aligning with `error:`

This is a small part of #4638
2023-03-27 20:45:11 -05:00
Ed Page
b6432c8ead docs(help): Show how to style text
Fixes #3108
Fixes #1433
2023-03-27 19:47:16 -05:00
Ed Page
5ebcb4c3bf feat(builder): Allow write! on StyledStr 2023-03-27 19:46:23 -05:00
Ed Page
f19e33eb27 perf(help): Reduce binary size 2023-03-27 19:46:22 -05:00
Ed Page
9516fd928f refactor(version): Directly convert rendered to styled 2023-03-27 19:45:41 -05:00
Ed Page
6255229a9c refactor: Remove extra layer of AnsiDisplay 2023-03-27 19:45:41 -05:00
Ed Page
1773884715 refactor(help): Simplify writing 2023-03-27 19:45:41 -05:00