Commit graph

5941 commits

Author SHA1 Message Date
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
Ed Page
478609a937 docs: Move item to correct release section 2022-06-14 07:07:10 -05:00
Ed Page
7836beda05 chore: Release 2022-06-14 07:02:40 -05:00
Ed Page
ea09f67666 docs: Go into more details on derive deprecation 2022-06-14 07:01:42 -05:00
Ed Page
a770000e55 docs: Update changelog 2022-06-14 06:49:27 -05:00
Ed Page
4001db6bdf
Merge pull request #3827 from epage/unstable
fix(derive): Switch default action/parser for `unstable-v4`
2022-06-13 20:06:57 -05:00
Ed Page
1ba6ef9080
Merge pull request #3818 from mbhall88/patch-1
docs: update return signature for try_from_os_str
2022-06-13 19:18:39 -05:00
Ed Page
0a529c14cc fix(derive): Switch default actions/parsers for unstable-v4 2022-06-13 18:59:58 -05:00
Ed Page
0c367104ae docs(derive): Update deprecation notice 2022-06-13 18:54:43 -05:00
Michael Hall
52403cd8cc
Update README.md 2022-06-14 09:16:52 +10:00
Ed Page
cc76d2881c test(derive): Allow specializing tests for unstable-v4 2022-06-13 17:00:39 -05:00
Ed Page
3686244264 test(derive): No longer supporting some wrapped types
With the new `ArgMatches`, we need to know what the inner type is.

Unfortunately, #3142 didn't list use cases for this.  We dropped the
`Option` alias changing `T` but we still have a `Result` in there that
is aliased.

One potential workaround if people need it is if we add an attribute to
specify the `get_many::<T>` type.  This would also help with
`ArgAction::Count` to support more data types.
2022-06-13 16:56:34 -05:00
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
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