Commit graph

5746 commits

Author SHA1 Message Date
Ed Page
b7668e84f5 test: Don't run legacy tests with v4 behavior 2022-06-13 16:47:25 -05:00
Ed Page
483b64ee8e test(derive): Update another case to new approach 2022-06-13 16:45:09 -05:00
Ed Page
0c367104ae docs(derive): Update deprecation notice 2022-06-13 18:54:43 -05:00
Ed Page
a96e7cfc7f
Merge pull request #3825 from epage/refactor
fix(derive): Tweak spans
2022-06-13 16:30:28 -05:00
Ed Page
9910b1477b fix(derive): Find a better target for validator deprecation warnings
Putting it on the doc comment is weird.  We are now putting it on the
field which is a slight improvement.  This better conveys "this is
auto-generated".

No test was added because the use case that I know of for exposing this
is short lived.
2022-06-13 16:14:05 -05:00
Ed Page
0096a4e881 fix(derive): Set the span for code generation 2022-06-13 15:19:23 -05:00
Ed Page
9757e38d05 refactor(derive): Be consistent in ValueEnum term 2022-06-13 12:52:31 -05:00
Ed Page
650a29c18b chore: Release 2022-06-13 09:37:47 -05:00
Ed Page
73ea5bc4a9 chore: Release 2022-06-13 09:33:33 -05:00
Ed Page
4e56acffce chore: Release 2022-06-13 09:31:29 -05:00
Ed Page
45d8bb1ff4 chore: Release 2022-06-13 09:28:17 -05:00
Ed Page
bd5605432c docs(lex): Update changelog 2022-06-13 09:27:17 -05:00
Ed Page
d25b80579f
Merge pull request #3821 from epage/test
Follow up to #3815
2022-06-13 09:25:24 -05:00
Ed Page
1d053e9b32 docs: Update changelog 2022-06-13 07:48:58 -05:00
Ed Page
d72b313bf2 test: Match rest of style 2022-06-13 07:48:06 -05:00
Ed Page
c8b45f75b8
Merge pull request #3820 from epage/panic
fix(assert): Tweak bad arg panics
2022-06-13 07:40:05 -05:00
梦想实现家
3eacf5b8b0
fix(builder): Don't double-has arg id in default_value_ifs_os (#3815) 2022-06-13 07:39:50 -05:00
Ed Page
a1320754f9 fix(assert): Be consistent in ID language for args 2022-06-13 07:08:38 -05:00
Ed Page
97f8041229 fix(assert): Add missing track_caller attributes 2022-06-13 07:04:59 -05:00
Ed Page
8bb3853eb5
Merge pull request #3816 from epage/dep
docs(parser): Encourage people to read the whole deprecation message
2022-06-10 19:59:29 -05:00
Ed Page
ca2846615c docs(parser): Encourage people to read the whole deprecation message 2022-06-10 19:41:50 -05:00
Ed Page
1c462be57a
Merge pull request #3814 from epage/contains
feat(parser): Provide updated version of 'is_present'
2022-06-10 14:36:37 -05:00
Ed Page
9caec5a52d fix(parser): Deprecate ArgMatches::is_present 2022-06-10 14:21:25 -05:00
Ed Page
d5e2622df9
Merge pull request #3813 from epage/anon
fix: Open the door for adding value_parser! specializations
2022-06-10 11:14:27 -05:00
Ed Page
cf3ad4fca6
Merge pull request #3812 from epage/discourage
fix: Further discourage `value_parser!` implementation details
2022-06-10 10:53:06 -05:00
Ed Page
f87fd0325c fix: Open the door for adding value_parser! specializations
I wanted to make the contract more clear that we might add more specific
value parsers in the future.
2022-06-10 10:52:38 -05:00
Ed Page
af0751c757 fix: Further discourage direct use of ValueParserVia* 2022-06-10 10:30:48 -05:00
Ed Page
8b37be4b01 fix: Further discourage direct use of AutoValueParser 2022-06-10 10:29:06 -05:00
Ed Page
9b7813558c feat(parser): Provide updated version if 'is_present'
- This matches the more container-like naming we are aiming for
- This provides an opportunity to warn people about moving away from
  `ArgAction::IncOcccurrences` for flags, like the deprecation for
  `ArgMatches::occurrences_of` to help people migrate in preparation for
  clap 4 (rather than having the behavior change subtly in a way only
  caught by thorough tests)

In addition, I feel `contains_id` has less ambiguous meaning than
`is_present`.
2022-06-10 10:16:44 -05:00
Ed Page
fce1125ba9 fix(assert): Allow required flags
Newstyle flags have defaults which prevents them from being required
until now.
2022-06-10 10:16:44 -05:00
Ed Page
54125aca55 docs(parser): Clarify we want arg ids
This was missed in #3453
2022-06-09 17:00:07 -05:00
Ed Page
aa9ca76b60
Merge pull request #3811 from epage/error
fix(parser): Always include pending arguments in errors
2022-06-09 13:57:03 -05:00
Ed Page
e70b3ff47b fix(parser): Always include pending arguments in errors
Found via cargo's UI tests
2022-06-09 13:41:24 -05:00
Ed Page
356ac55ce8
Merge pull request #3810 from epage/count
perf(parser): Take up less memory with ArgAction::Count
2022-06-09 12:14:56 -05:00
Ed Page
31b22d1a51 perf(parser): Take up less memory with ArgAction::Count
Someone should not reasonably expect a coun flag to go up to billions,
millions, or even thousands.  255 should be sufficient for anyone,
right?

The original type was selected to be consistent with
`ArgMatches::occurrences_of` but that is also used for tracking how
many values appear which can be large with `xargs`.

I'm still conflicted on what the "right type" is an wish we could
support any numeric type.  When I did a search on github though, every
case was for debug/quiet flags and only supported 2-3 occurrences,
making a `u8` overkill.

This came out of a discussion on #3792
2022-06-09 11:09:38 -05:00
Ed Page
acfb130b0d fix(parser): Prevent rollover of count 2022-06-09 11:05:06 -05:00
Ed Page
cb86785c7f docs: Update changelog 2022-06-09 10:47:08 -05:00
Ed Page
4b505ddf12
Merge pull request #3806 from epage/changelog
docs: Update changelog
2022-06-08 21:11:12 -05:00
Ed Page
653e121bcc
Merge pull request #3805 from epage/visibility
fix(builder): Clean up after hiding `AnyValueParser`
2022-06-08 21:10:33 -05:00
Ed Page
01b5e1ee5b perf(builder): Avoid Arc for value parsers
There isn't a strong need for the single-instance at the cost of the
extra book keeping.
2022-06-08 20:57:00 -05:00
Ed Page
d73ff562d1 fix(builder): Move trait requirements closer to the user
My hope is this will provide clearer error messages for the user.
2022-06-08 20:41:51 -05:00
Ed Page
4dc0136b2c fix(parser): Hide AnyValue
With `AnyValueParser` now private, we can also make `AnyValue` private.
Most users should not need to call `ValueParser::parse_ref` and doing
this gives us more implementation freedom for the future.
2022-06-08 20:22:39 -05:00
Ed Page
a849a28a04
Merge pull request #3804 from epage/version
fix(assert): Reslve regressions for auto-help / auto-version
2022-06-08 20:19:34 -05:00
Ed Page
ebf21a3280 fix(assert): Don't assert in more cases 2022-06-08 17:39:14 -05:00
Ed Page
c61a105e62 fix(builder): Fix regression with auto-help / auto-version 2022-06-08 17:17:50 -05:00
Ed Page
035bc804d1 fix(builder): Dump action in debug output 2022-06-08 16:39:27 -05:00
Ed Page
3052fece16 fix(builder): Make it easier to debug globals 2022-06-08 16:35:56 -05:00
Ed Page
588c46b6c6 docs: Update changelog 2022-06-08 15:04:53 -05:00
Ed Page
731408ee80
Merge pull request #3801 from SabrinaJewson/private-any-value-parser
Make `AnyValueParser` private
2022-06-08 14:56:39 -05:00
SabrinaJewson
560f0c076a
fix: Appease CI 2022-06-08 20:45:25 +01:00