Commit graph

10 commits

Author SHA1 Message Date
Ed Page
60c9c2e59a docs(derive): Use more-specific traits
This helps to raise visibility of the new derive traits.

I didn't touch ui tests because there were a lot and they didn't seem to
be as high value.
2021-10-12 07:51:11 -05:00
Ed Page
d840d5650e fix(derive)!: Rename Clap to Parser.
Before #2005, `Clap` was a special trait that derived all clap traits it
detected were relevant (including an enum getting both `ArgEnum`,
`Clap`, and `Subcommand`).  Now, we have elevated `Clap`, `Args`,
`Subcommand`, and `ArgEnum` to be user facing but the name `Clap` isn't
very descriptive.

This also helps further clarify the relationships so a crate providing
an item to be `#[clap(flatten)]` or `#[clap(subcommand)]` is more likely
to choose the needed trait to derive.

Also, my proposed fix fo #2785 includes making `App` attributes almost
exclusively for `Clap`.  Clarifying the names/roles will help
communicate this.

For prior discussion, see #2583
2021-10-09 20:12:03 -05:00
Ed Page
f681e46414 test(derive): Port structopt flatten coverage
https://github.com/TeXitoi/structopt/pull/414 was ported in
a95195874 but the test was less exhaustive.  This updates our test to
match structopt's latest version of the test.

This is a part of #2809
2021-10-07 10:02:34 -05:00
Ivan Tham
f484e2da11 Derive doc clap ordering for multiple Clap
Fix #2527
2021-08-11 23:31:00 +01:00
Ed Page
6a70c744e0 fix(derive): Allow partial update of flattened Subcommand arguments
When using `#[clap(flatten)]` inside of a `Subcommand`, we would do a
`from` instead of an `update`.

The challenge is knowing when we are
going into a flattened subcommand vs changing the variant.  To resolve
this, I added a `Subcommand:has_subcommand(name)` trait method that we
generate, so we can ask.
2021-07-27 12:14:53 -05:00
Luca Barbato
646b3fe811 wip: Add tests and user-facing functions 2020-11-14 10:17:13 +01:00
CreepySkeleton
a951958748 Allow flatten with doc comments 2020-08-25 20:20:56 +03:00
Pavan Kumar Sunkara
f0a216036b Fix some issues 2020-04-09 19:41:33 +02:00
Cecile Tonglet
8f3eb4623e Implemented: flatten on enums
Fixes #327
2020-02-05 09:10:59 +03:00
Pavan Kumar Sunkara
5e8f424dfe Merged clap_derive using git-subtree 2020-01-18 17:40:07 +05:30