Commit graph

4854 commits

Author SHA1 Message Date
Ed Page
efca08341a docs(tutorial): Fix derive anchor links 2021-12-23 08:23:32 -06:00
Ed Page
b6b6e1eab0
Merge pull request #3209 from justjavac/patch-1
docs: Fix anchor links
2021-12-23 08:22:11 -06:00
迷渡
c60d5dd1f0
docs: Fix anchor links 2021-12-23 10:58:14 +08:00
Ed Page
edca3c0902
Merge pull request #3208 from epage/todo
chore: Remove the TODO chaff
2021-12-22 10:44:21 -06:00
Ed Page
895e85714b chore: Remove the TODO chaff
The intent is to make stand out more the important technical debt hidden
in comments.
2021-12-22 10:15:09 -06:00
Ed Page
90d4a3ca73
Merge pull request #3207 from epage/direct
refactor: Clarify validator relationships
2021-12-22 10:10:05 -06:00
Ed Page
88c927aad3 refactor: Clarify validator relationships
We were storing data off into the struct, obscuring the direct
relationship between gathering and validating conflicts.

With this, not as much code needs to deal with mutable data
2021-12-22 09:14:39 -06:00
Ed Page
2d17f1b59f
Merge pull request #3204 from epage/debug
fix(debug): Refer to correct function
2021-12-21 20:57:06 -06:00
Ed Page
2e73be43f1 fix: Ensure we validate required-unless
Found this when digging into #3197
2021-12-21 20:41:17 -06:00
Ed Page
2d462cd0b5 fix(debug): Refer to correct function 2021-12-21 20:35:23 -06:00
Ed Page
3ae0132f8c docs(changelog): Link out for newline change 2021-12-20 08:38:55 -06:00
Ed Page
65a18247bf docs: Update toml on pre-release 2021-12-17 10:58:01 -06:00
Ed Page
a861053928
Merge pull request #3195 from bestouff/patch-1
docs: More explicit "derive" feature
2021-12-17 10:55:42 -06:00
Xavier Bestel
8654c9035c docs: Automatically update version in README.md 2021-12-17 17:09:25 +01:00
Ed Page
a61a63ac88
Merge pull request #3196 from epage/help
fix(help): Don't infer long help from subcommands
2021-12-17 09:54:02 -06:00
Xavier Bestel
e3a711ec12 docs: More explicit "derive" feature 2021-12-17 16:29:47 +01:00
Ed Page
318b7859dc fix(help): Don't infer long help from subcommands
Fixes #3193
2021-12-17 09:25:00 -06:00
Ed Page
27893cfd9a chore: Release 2021-12-16 12:19:58 -06:00
Ed Page
9da7a5c0e1
Merge pull request #3192 from epage/derive
docs(derive): Call out need for derive feature
2021-12-16 12:18:38 -06:00
Ed Page
b4fbd05196 docs(derive): Call out need for derive feature
And other derive tweaks.  I'm mixed on how far to go, including
- Linking to the derive reference
- Showing how to use each trait with both the derive and builder APIs

For now, this is an improvement.
2021-12-16 12:05:52 -06:00
Ed Page
43aa505221
Merge pull request #3190 from epage/feature
docs: Show features in docs.rs
2021-12-16 10:56:17 -06:00
Ed Page
d14255dc00 docs: Show features in docs.rs
Confirmed this works with [`argfile`](https://docs.rs/argfile/latest/argfile/)

And then running in clap
```
$ RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
```
They now show up!
2021-12-16 10:38:31 -06:00
Ed Page
c212402466 chore: Release 2021-12-16 09:33:06 -06:00
Ed Page
b9a9a80a27
Merge pull request #3188 from epage/default
feat(derive): Don't require Display for default ArgEnum
2021-12-16 09:31:09 -06:00
ilslv
74d1c0898f
chore: Update version requirements (#3187)
Bump `termcolor` and `trybuild`
2021-12-16 09:18:54 -06:00
Ed Page
8924dd7a1e feat(derive): Don't require Display for default ArgEnum
While I'm unsure how much type specialization we should do, we
intentionally have the `arg_enum` attribute for doing special behavior
based on it, so let's take advantage of it.

Fixes #3185
2021-12-16 09:11:32 -06:00
Ed Page
dee3adbd34 fix: Loosen lifetimes on PossibleValue 2021-12-16 09:07:05 -06:00
Ed Page
fd38d247a7
Merge pull request #3180 from epage/cargo
docs(examples): Add cargo subcommand example
2021-12-15 12:19:26 -06:00
Ed Page
aa270f6aca docs(examples): Add cargo subcommand example 2021-12-15 12:07:29 -06:00
Ed Page
03cb509d6c refactor(examples): Change naming style
This is to make room for a reasonable looking cargo plugin example.

I got lazy and didn't update the tutorials.
2021-12-15 11:12:18 -06:00
Ed Page
1100f04b56 chore: Release 2021-12-15 11:02:40 -06:00
Ed Page
95198c95f3 docs: Update changelog 2021-12-15 11:02:12 -06:00
Ed Page
f0c7a72a5c
Merge pull request #3179 from epage/man
revert(help): Partial revert of 3c049b4
2021-12-15 10:47:48 -06:00
Ed Page
9e64387ef0 revert(help): Partial revert of 3c049b4
The extra whitespace was targeted at machine processing for a subset of
users for a subset of runs of CLIs.  On the other hand, there is a lot
of concern over the extra verbose output.

A user can set the help template for man, if desired.  They can even do
something (env? feature flag?) to make it only run when doing man
generation.  We also have #3174 in the works.

So let's focus on the end-user reading `--help`.  People wanting to use
`help2man` have workarounds to do what they need.

Fixes #3096
2021-12-15 10:36:59 -06:00
Pavan Kumar Sunkara
56ed9981da
Merge pull request #3176 from epage/gen
docs(gen): Use absolute paths for docs.rs sake
2021-12-14 19:35:00 +00:00
Ed Page
8e5a62faed docs(gen): Use absolute paths for docs.rs sake
Using relative paths will work from github but when we include
`README.md` into `lib.rs`, they will break.
2021-12-14 13:02:20 -06:00
Ed Page
b3315f995d
Merge pull request #3175 from epage/help
fix(derive)!: Set both about/long_about with doc comments
2021-12-14 12:04:11 -06:00
Ed Page
d55f040bbd fix(derive): Set both about/long_about with doc comments
The main care about is that when we override a `flatten` / `subcommand`
doc comment in a parent container, that we make sure we take nothing
from the child container, rather than implicitly taking one `about` ut
not `long_about`.

To do this, and to play the most safe with long help detection, we reset
`long_about` to default when there is no doc comment body to use for
`long_about`.

Fixes #2983
2021-12-14 11:07:57 -06:00
Ed Page
1811f5e7af test(derive): Show current doc comment behavior
Based on #2983
2021-12-14 11:07:54 -06:00
Ed Page
80f426af49 feat!: Allow resetting abouts/help to default
I dislike the inconsistency with only a few fields providing this (this
and `help_heading`) but this is to address a specific bug.  We need to
visit this, along with iterators (#2870) and string handling (#2150).

`Arg` came along for the ride because the derive logic is applied to
both.  `PossibleValue` didn't need it because we filter out `long_help`.

BREAKING CHANGE: We changed the signatures for `App::about`,
`App::long_about`, `Arg::help`, and `Arg::long_help` from accepting
anything `Into<&str>` to `&str`.
2021-12-14 11:07:39 -06:00
Ed Page
05cf230ac1
Merge pull request #3170 from epage/default
fix(derive): Treat `default_value_os` like `default_value`
2021-12-13 16:37:26 -06:00
Ed Page
7c10b5a9b4 fix(derive): Treat default_value_os like default_value
The test went from panicing to not-panicing

Fixes #3031
2021-12-13 16:25:49 -06:00
Pavan Kumar Sunkara
8eb55381ca
Merge pull request #3169 from epage/help
fix(help): Don't commit to '--help' that doesn't work
2021-12-13 22:15:58 +00:00
Ed Page
19ed78c64f fix(help): Don't commit to '--help' that doesn't work
We have two ways of fixing this
- Making `--help` work
- Don't put `--help` in the help output

For now, I went with the latter.  I tried to make it clear what the
actual requirement is so we can pivot if needed.

Fixes #2892

This happens to also fix the interaction of `DisableHelpFlag` with the
help subcommand and complcations.  I've added a test to help catch if we
break this by changing how we fixed the original issue.

Fixes #2724

These issues were reported against clap3.  I've not tried to reproduce
these in clap2 to see if they should show up in the release notes.
2021-12-13 15:59:14 -06:00
Ed Page
fa439d4f27
Merge pull request #3168 from epage/error
Ensure trailing newlines at the end of errors
2021-12-13 14:15:22 -06:00
Ed Page
a72e5726f8 fix(error): Ensure newline on value_of_t not found
Found this when auditing for cases related to #2787.
2021-12-13 13:30:32 -06:00
Ed Page
4c8caa6eb3 test(error): Add explicit value_of_t test case
This adds an explicit test case for
221c18bdec when before we covered it via
the example tests.
2021-12-13 13:30:28 -06:00
Ed Page
2eb69def4e fix(error): Ensure trailing newline without help
Fixes #2787
2021-12-13 13:09:48 -06:00
Pavan Kumar Sunkara
6b6f01006d
Merge pull request #3167 from epage/exhaustived
fix!: Allow adding new enum variants
2021-12-13 18:34:35 +00:00
Ed Page
98a1c2e6c9 fix!: Allow adding new enum variants
Without being a breaking change.

This seems minor enough that we can break this during the release
candidates.  For `ValueHint`, the completion scripts are 99% of who
should be `match`ing it.  `AppSettings` as undocumented variants that
people shouldn't use.

BREAKING CHANGE: `clap::{ValueHint, ErrorKind, AppSettings,
ArgSettings}` are now `non_exhaustive`.
2021-12-13 12:11:00 -06:00