Commit graph

5857 commits

Author SHA1 Message Date
Ed Page
3c4e684c8b test: Verify auto-traits for core types
By checking these types, we'll get some other types for free, like
`Command` verifying `Arg`.

This was inspired by #3876
2022-06-27 20:50:29 -05:00
Ed Page
a05f4d34a3
Merge pull request #3870 from stepancheg/macro-refs
Put once_cell reexport into __macro_refs
2022-06-27 20:44:01 -05:00
Ed Page
5ba41d775c docs(license): Update years/holders
Without copyright assignment, everyone owns their own copyright, so
tried to reflect that.

See #3875
2022-06-27 12:55:09 -05:00
Stiopa Koltsov
464ef3920b refactor: Put once_cell reexport into __macro_refs
When upgrading our company projects from clap 3.1 to clap 3.2 I had
to fix several references to `clap::lazy_init`. People are not
supposed to do that, but that's hard to enforce.

Hope placing `once_cell` reexport into `__macro_refs` prevent at
least some of the such issues in the future.
2022-06-26 04:13:03 +01:00
Ed Page
08d12b6db4
Merge pull request #3866 from hw-lunemann/derive-ref-spelling-fix
Fix spelling of 'APIs' in the derive docs
2022-06-25 19:16:33 -05:00
hw-lunemann
7e785ad9d6 Fix spelling of APIs 2022-06-25 00:55:48 +02:00
Ed Page
b2779f2249
Merge pull request #3862 from epage/deprecate
fix(docs): Update deprecations to latest target
2022-06-22 15:18:04 -05:00
Ed Page
f9e51952b8 fix(docs): Update deprecations to latest target
Before, I was mixed on doing this as ideally people would upgrade
through the minor releases, going through the release notes.  This also
saves us havin to audit deprecations to make sure they are all pointing
to the latest.

First, this isn't practical for users.  Its annoying to pin your version (at least
its easier now that we pin `clap_derive` for users) and a lot of work to
go through them one step at a time.

On top of that, we've changed our deprecation policy to put the timing
of responding to deprecations into the user's hands with, with us
putting them behind the `deprecated` feature flag.  This means someone
might respond to deprecations every once in a while or might not do it
until right before the 4.0 release.  Our deprecation messages should be
updated to respond to that.

This supersedes #3616
2022-06-22 14:31:15 -05:00
Ed Page
3823df9bbe chore: Release 2022-06-21 09:32:04 -05:00
Ed Page
8a659bc2b4 docs: Update changelog 2022-06-21 09:31:11 -05:00
Ed Page
ceb7ee4f54
Merge pull request #3860 from epage/panic
fix(parser): Don't panic on `--=`
2022-06-21 09:30:19 -05:00
Ed Page
01da890145 fix(parser): Don't panic on --=
This broke when we introduced clap_lex and then did a refactor on top.
We put in guards to say that escapes shouldn't happen but missed `--=`
which isn't quite an escape.

Not fully set on what error should be returned in this case (we are
returning roughly what we used to) but at least
we aren't panicing.

Fixes #3858
2022-06-21 08:53:04 -05:00
Ed Page
dabb5713d4
Merge pull request #3853 from dtolnay-contrib/valuevalidation
Fix typo in ErrorKind::ValueValidation message
2022-06-17 15:39:37 -05:00
David Tolnay
690530a191
Fix typo in ErrorKind::ValueValidation message 2022-06-17 13:07:09 -07:00
Ed Page
ae78f88d48
Merge pull request #3852 from epage/msrv
chore: Bump MSRV from 1.56.0 to 1.56.1
2022-06-17 09:23:06 -05:00
Ed Page
82d70d82c4 chore: Bump MSRV from 1.56.0 to 1.56.1
Being a patch release, I'm fine doing this outside of a minor release.
This avoids us having to deal with indexmap having a higher MSRV.
2022-06-17 09:01:45 -05:00
Ed Page
8c28bec396
Merge pull request #3851 from tshepang/trim-manifest
chore: trim Cargo manifest fields whose values are defaults
2022-06-17 08:59:41 -05:00
Tshepang Mbambo
806f634bfa chore: trim Cargo manifest fields whose values are defaults
See...
- https://doc.rust-lang.org/cargo/reference/manifest.html?#the-documentation-field
- https://doc.rust-lang.org/cargo/reference/manifest.html?#the-readme-field
2022-06-17 15:49:04 +02:00
Ed Page
5fdc26ee9a
Merge pull request #3844 from epage/occurrences
fix(parser): Add value_source as a replacement for occurrences_of
2022-06-16 13:50:17 -05:00
Ed Page
f131d46b99 fix(parser): Add value_source as a replacement for occurrences_of
This was an oversight when listing out the options as identified when
looking at oxidecomputer/humility#161.
2022-06-16 13:29:31 -05:00
Ed Page
48d23b4c02
Merge pull request #3841 from epage/value_hint
test(complete): Ensure we infer path completions from value_parser
2022-06-16 10:28:53 -05:00
Ed Page
ea3bd55993 test(complete): Ensure we infer path completions from value_parser
Looks like I forgot to add a test case for this.

I put this in `clap_complete` because I expect `ValueHint` to move here
as we move towards a plugin system.

Fixes #3840
2022-06-16 09:59:30 -05:00
Ed Page
a7698e9a1d chore: Release 2022-06-15 11:50:16 -05:00
Ed Page
be2a2c050a docs: Update changelog 2022-06-15 11:50:02 -05:00
Ed Page
d5bf866a5d
Merge pull request #3837 from epage/bool
docs: Provide a hybrid-flag example
2022-06-15 11:47:10 -05:00
Ed Page
40daa70b89 docs: Provide a hybrid-flag example
Between
- `ArgAction::SetTrue` storing actual values
- `ArgAction::Set` making it easier for derive users to override bool
  behavior
- `Arg::default_missing_value` allowing hybrid-flags
- This commit documenting hybrid-flags even further

There shouldn't be anything left for #1649

Fixes #1649
2022-06-15 11:09:53 -05:00
Ed Page
c9988db97f docs(builder): Clean up default_missing_value's docs 2022-06-15 10:59:34 -05:00
Ed Page
82fd204ab5
Merge pull request #3836 from epage/help
fix(help): Improve debug output for help
2022-06-15 10:43:06 -05:00
Ed Page
3c9f24ac29
Merge pull request #3834 from omjadas/fix/default-value-os-t
fix: default_value_os_t
2022-06-15 10:07:19 -05:00
Ed Page
eba753f162 fix(help): Further debug clean up 2022-06-15 10:03:52 -05:00
Ed Page
c443aa0b5d refactor(help): Collapse useless function 2022-06-15 09:31:19 -05:00
Ed Page
17d975743a fix(help): Improve debug output 2022-06-15 09:25:18 -05:00
omjadas
4d521429be test: Add test for default_value_os_t 2022-06-15 13:46:59 +10:00
omjadas
b1be436eda fix: Fix compile error caused by default_value_os_t 2022-06-15 13:46:40 +10:00
Ed Page
20358ff295 chore: Release 2022-06-14 15:01:42 -05:00
Ed Page
241a6fcfbc docs: Update changelog 2022-06-14 15:01:19 -05:00
Ed Page
ffd24af5fe
Merge pull request #3832 from epage/derive
fix(derive): Provide derive-friendly deprecation messages
2022-06-14 14:59:56 -05:00
Ed Page
5881bd02ca fix(derive): Provide derive-friendly deprecation messages
This is a step towards #3822.  I'd say this fixes it but I'd want some
user acceptance before doing so.
2022-06-14 14:29:29 -05:00
Ed Page
11fe3ce404 fix(derive): Allow opting in to the original deprecations 2022-06-14 14:26:34 -05:00
Ed Page
ae81b09359 refactor(derive): Split up chained calls 2022-06-14 12:37:21 -05:00
Ed Page
ce5cc92820 refactor(derive): Clarify the kinds of methods 2022-06-14 12:35:19 -05:00
Ed Page
89beb28e73 fix(derive): Reduce amount of deprecation noise
The main thing that might slip through is `bool`.  We'll see if we an
re-introduce that.
2022-06-14 12:24:57 -05:00
Ed Page
63a17a40ad chore: Release 2022-06-14 11:19:59 -05:00
Ed Page
d290f11b8d docs: Update changelog 2022-06-14 11:19:23 -05:00
Ed Page
b619699539
Merge pull request #3830 from epage/deprecate
fix: Allow people to opt-in to deprecations
2022-06-14 11:07:03 -05:00
Ed Page
7515bfeb51 fix: Allow people to opt-in to deprecations
This adds a new `Cargo.toml` feature named `deprecated` that opts
controls whether deprecation warnings show up.  This is starting off as
non-default though that may change (see below).

Benefits
- Allows a staged rollout so a smaller subset of users see new
  deprecations and can report their experience with them before everyone
  sees them.  For example, this reduces the number of people who have to
  deal with #3822.
- This allows people to defer responding to each new batch of
  deprecations and instead do it at once.  This means we should
  reconsider #3616.

The one risk is people who don't follow blog posts and guides having a
harder time upgrading to the next breaking release without the warnings
on by default.  For these users, we reserve the right to make the
`deprecated` feature `default`.  This is most likely to happen in a
minor release that is released in conjunction with the next major
release (e.g. when releasing 4.0.0, we release a 3.3.0 that enables
deprecations by default).  By using a feature, users can still disable
this if they want.

Thanks @joshtriplett for the idea
2022-06-14 10:50:05 -05:00
Ed Page
d71e38ebc2
Merge pull request #3829 from epage/lazy
refactor: Switch to once_cell
2022-06-14 09:44:17 -05:00
Ed Page
cb42df61e4 refactor: Switch to once_cell
Though this is changing an API item we export, we do not consider this a
breaking change because
- This was an implementation detail of the macros and people shouldn't be using it directly
- The `macro_rules` macro is coupled to `clap` because they are in the
  same crate
- The derive macro is coupled to `clap` because `clap` declares a
  `=x.y.z` dependency on `clap_derive

Fixes #3828
2022-06-14 09:10:50 -05:00
Ed Page
b541f2c880 docs(change): Note debug/release assert change 2022-06-14 08:48:36 -05:00
Ed Page
c510c9da19 docs: Put compatibility first in changelog 2022-06-14 08:47:10 -05:00