Commit graph

307 commits

Author SHA1 Message Date
Ed Page
cb937641fa fix(derive): Allow other attributes with subcommand that has subcommands
This was overlooked when we added support for `#[clap(subcommand)]` to
variants.

Fixes #3504
2022-02-23 09:23:33 -06:00
Ed Page
e6729f96c3 chore: Release 2022-02-16 11:59:45 -06:00
Ed Page
ddac492302 fix: Rename IntoApp to CommandFactory
This is part of the `App` rename.

Previously, I was concerned about not being able to deprecate

For backwards compatibility, we still expose the `IntoApp` name.
2022-02-15 08:24:00 -06:00
Ed Page
c3fec1fa75 fix: Update derive->Command function name
No good solution for transitioning the trate name, unfortnately, since
we can't mark `use`s as deprecated (we can, it just does nothing).

I got rid of the `into` prefix because that implies a `self` parameter
that doesn't exist.
2022-02-14 16:04:10 -06:00
Ed Page
e8010e79a9 refactor: Update app variables to cmd 2022-02-14 15:55:56 -06:00
Ed Page
c4144d7d6c docs: Update App references to Command 2022-02-14 15:33:49 -06:00
Ed Page
4895a32e81 fix: Deprecate SubcommandRequiredElseHelp
Now that we can use `SubcommandRequired |
ArgRequiredElseHelp`, this setting offers little value but requires we
track required subcommands with two different settings.  Deprecating as
the cost is not worth the benefit anymore.

Issue #3280 will see the derive updated
2022-02-11 15:31:25 -06:00
Ed Page
85908ce039 refactor(derive): Remove redundant code paths
I'm assuming this is from when structopt always set author, version, and
about and you had to apply other attributes to remove them.
2022-02-11 13:19:14 -06:00
Ed Page
272f840178 feat: Replace core set of AppSettings with functions
This is a part of #2717

Some settings didn't get getters because
- They are transient parse settings (e.g. ignore errors)
- They get propagated to args and should be checked there

`is_allow_hyphen_values_set` is a curious case.  In some cases, we only
check the app and not an arg.  This seems suspicious.
2022-02-11 12:35:09 -06:00
Ed Page
5290f82133 feat: Override DeriveDisplayOrder behavior with App::next_display_order
For the derive API, you can only call `next_display_order` when dealing
with a flatten.  Until we offer app attributes on arguments, the user can workaround with
this no-op flattens.

This is a part of #1807
2022-02-07 19:19:11 -06:00
Ed Page
c00f71ec4a feat: Add App::next_help_heading
This clarifies the intent and prepares for other functions doing the
same, like `next_display_order`.  This will then open us to name
`subcommand_help_heading` and `display_order` similar.

The deprecation is waiting on 3.1.

This is part of #1807 and #1553.
2022-02-07 19:19:01 -06:00
Ed Page
dc035de409 chore: Release 2022-02-01 16:11:53 -06:00
Rob Donnelly
a19bca8a10 docs(error): Update link to explicit bool parser example 2022-01-31 21:58:54 -08:00
Ed Page
ea7699c11f chore: Release 2022-01-24 15:34:27 -06:00
omjadas
86c83d296f
feat: Add default_value_os_t (#3333)
The order of suffixes allows us to preserve the original builder function name.

This is a part of #2813
2022-01-24 15:32:21 -06:00
Ed Page
e5b06c3061 chore: Release 2022-01-24 10:54:50 -06:00
Ed Page
4c2d65e290 docs(derive): Have crate link out to specific docs 2022-01-18 19:41:29 -06:00
Ed Page
811fd6a04a chore: Release 2022-01-10 16:16:18 -06:00
Ed Page
c494da93ce chore: Share a tag between clap / clap_derive 2022-01-10 16:16:04 -06:00
Ed Page
3326a11be0 fix(derive): Don't assume use clap::ArgEnum
The error was when doing `#[clap(arg_enum, default_value_t = ...)]`.

Good example of why we should minimize `use`, at least in tests
(besides reducing merge conflicts, code churn, etc).
2022-01-10 15:41:58 -06:00
Ed Page
ef823bbeaf chore: Release 2022-01-05 16:28:24 -06:00
Noa
ffd991f0ae
chore: Fix clap_derive license headers 2022-01-04 14:25:48 -06:00
Ed Page
d9906eb150 chore: Release 2022-01-04 09:49:41 -06:00
Daniel Eades
2986a9eee0 style: remove unnecessary lazy evaluations 2022-01-04 09:20:17 -06:00
Daniel Eades
7f71d642cd style: prefer 'char' to 'str' for single character patterns 2022-01-04 09:20:08 -06:00
Ed Page
bcbe126b4d chore: Release 2022-01-03 18:53:28 -06:00
Ed Page
6b9ae5404c fix(derive): Don't enit warnings
We missed covering `Args` warnings when using struct variants.

Fixes #3245
2022-01-03 11:35:34 -06:00
Ed Page
42f6c72caa chore: Upgrade heck 2022-01-01 20:31:53 -06:00
Ed Page
c01ebbac17 chore: Release 2021-12-31 14:35:02 -06:00
Ed Page
bc951e4e53 chore: Release 2021-12-31 13:37:28 -06:00
Ed Page
8d73a0e80f chore: Release 2021-12-31 12:23:47 -06:00
Ed Page
2d7dc1ff8f chore: Release 2021-12-30 15:00:19 -06:00
Ed Page
ea02f6125d chore: Release 2021-12-30 14:28:32 -06:00
Ed Page
ff713d5ae5 chore: Release 2021-12-27 15:57:27 -06:00
Ed Page
8d94739de4 chore: Release 2021-12-23 14:28:46 -06:00
Ed Page
27893cfd9a chore: Release 2021-12-16 12:19:58 -06:00
Ed Page
c212402466 chore: Release 2021-12-16 09:33:06 -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
1100f04b56 chore: Release 2021-12-15 11:02:40 -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
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
Ed Page
c3f8c8938f chore: Release 2021-12-10 15:25:23 -06:00
Ed Page
43d3ac37a6 fix(derive): Allow aliased Option with ArgEnum 2021-12-10 10:41:55 -06:00
Frankie Foston
1285c0f885 fix: unqualified result types causing compilation failures with derive implementations 2021-12-10 14:13:26 +00:00
Ed Page
ada95d6f3d chore: Release 2021-12-09 19:39:08 -06:00
Ed Page
3dec7df14f chore: Release 2021-12-09 07:00:33 -06:00
Ed Page
febf7c637e docs(derive): Note using fully-qualified path 2021-12-08 19:58:41 -06:00
Janik Rabe
7b1ea308a0 fix(derive): Use fully qualified types
This fixes `#[derive(Parser)]` when a custom `Result` type is in scope.
2021-12-08 21:07:49 +00:00
Ed Page
d444f46f92 chore: Release 2021-12-08 12:41:59 -06:00
Ed Page
cf623d9e53 fix(derive): Update structopt links
Fixes #1671
2021-12-08 11:28:25 -06:00