Commit graph

4677 commits

Author SHA1 Message Date
Ed Page
9167fdebf3 fix(derive): Don't emit warnings
Looks like this is coming from `update_from_arg_matches` where we do a
ladder of `if __clap_arg_matches.is_present(...)` that clippy wants to
be `else if`s.  While for human edited code, that does clarify intent,
for machine generated code that is rarely read, its a pain to do, so
silencing it.

Unfortunately, it isn't in a group we can overall silence.

Fixes #3017
2021-11-12 12:52:18 -06:00
bors[bot]
98c1a75949
Merge #3016
3016: Revert "Automatically read license field from Cargo.toml" r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-12 16:16:35 +00:00
Ed Page
7a59dc3da4 Revert "Automatically read license field from Cargo.toml"
This reverts commit 6898fbde33.

PR #2144 added the `license` field but no consumer has been added since
the (like Issue #1768).  Since this is not ready yet, I am pulling it
from the 3.0 release.

So far, our main route for pulling a feature from the release has
been to put it behind a `unstable-*` feature flag and to create a
stablization tracking issue.  I chose to instead remove the feature
because a write-only field with no effect does not provide values for
people to use in as an early access and so doesn't outweight the cost of
the extra documentation noise and code noise it creates.  Additionally,
keeping an `unstable-` feature around when it has such an unknown path
(and time table) to stalbization feels like it violates YAGNI.  I'm
uncertain how much of this feature we can implement and not create a
legal trap for users because the crate's license is insufficient for the
final artifact's license.  I feel our stabliazation process sshould be
about iteration and collecting user feedback which this doesn't line up
with.

When someone is ready to tackle #1768, it will be easy to revert this
commit and pick up the work again.

Fixes #3001
2021-11-12 09:55:37 -06:00
bors[bot]
3092751f6d
Merge #2985
2985: Follow up to #2950 r=epage a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-11-11 22:50:35 +00:00
Pavan Kumar Sunkara
301c6f765a Added and used ArgPredicate api 2021-11-11 22:33:30 +00:00
Pavan Kumar Sunkara
43a4c90c86 Remove is_default_value in favor of contains_explicit_value 2021-11-11 22:07:29 +00:00
Pavan Kumar Sunkara
4e29777b21 Added contains_explicit_val function instead of contains_val 2021-11-11 22:07:29 +00:00
Pavan Kumar Sunkara
69957c4ddd Revert "Revert "Fixes arg having required_unless on default values""
This reverts commit 6e85fb3ae0.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
bdb1d324a5 Revert "Revert "Fixes arg having required_if on default values""
This reverts commit 8818327b25.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
b102da0cd2 Revert "Revert "Fixes arg and group with default value having requires""
This reverts commit bd8c36cf04.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
72429be14e Revert "Revert "Fixes group conflicting if two args with default values""
This reverts commit 4e370bb093.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
0b7def675b Revert "Revert "Fixes arg conflicting with group whose arg has default value""
This reverts commit 706085d9c5.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
b86aa631be Revert "Revert "Fixes group conflicting with arg which has default value""
This reverts commit 736cb28dd0.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
6b458c602d Revert "Revert "Added ArgMatcher::is_default_value abstraction""
This reverts commit 5e76e6c568.
2021-11-11 21:33:50 +00:00
Pavan Kumar Sunkara
45f281b67e Revert "Revert "Revert "docs: Clarify corner caseses with default values"""
This reverts commit 98f696c0a6.
2021-11-11 21:33:50 +00:00
bors[bot]
9dd59ad341
Merge #2996
2996: fix typo r=pksunkara a=bacongobbler



Co-authored-by: Matthew Fisher <matt.fisher@fishworks.io>
2021-11-11 18:05:03 +00:00
Ed Page
a2c3b14bb0 fix(app): Propogate color
In #2851, we moved color from an AppSetting to function (with some
tweaks in #2907).  When doing this, we documented `App::color` to be
equivalent of `App::global_settings(Color...)` but never actually
propagated it.

We are now propagating it.  A test is added to ensure that no matter
how we store the color choice, we continue to propagate it.  This
required exposing `App::get_color`.
2021-11-11 11:39:21 -06:00
Ed Page
ae67496473 feat(app): Expose App::get_color
This will be important for testing color support.  No idea how much
users will care.
2021-11-11 11:34:20 -06:00
bors[bot]
00a0c4ee14
Merge #2997
2997: fix check warnings r=epage a=bacongobbler



Co-authored-by: Matthew Fisher <matt.fisher@fishworks.io>
2021-11-05 19:03:46 +00:00
Matthew Fisher
a769071f72
fix check warnings
Signed-off-by: Matthew Fisher <matt.fisher@fishworks.io>
2021-11-05 11:38:06 -07:00
Matthew Fisher
2232afbe99
fix typo
Signed-off-by: Matthew Fisher <matt.fisher@fishworks.io>
2021-11-05 11:17:59 -07:00
bors[bot]
6b0c49e840
Merge #2994
2994: Revert:  Add new App::mut_args for mutating all arguments #2966  r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-05 15:15:43 +00:00
Ed Page
839ad67b6b Revert "Add App::mut_args"
This reverts commit 6e4ac4cffc.
2021-11-05 09:29:38 -05:00
Ed Page
23b1502c00 Revert "Fix docs variable name"
This reverts commit 0dded91541.
2021-11-05 09:28:23 -05:00
Ed Page
71ff62c37e Revert "Add no_auto_version_mut_args test"
This reverts commit 3a9d40fcb8.
2021-11-05 09:28:22 -05:00
Ed Page
3e838d1b77 Revert "Add partial_mut_args test"
This reverts commit 1c73c46af9.
2021-11-05 09:28:20 -05:00
Ed Page
2537894c4b Revert "Fix test to support env feature disabled"
This reverts commit 477f884af1.
2021-11-05 09:28:15 -05:00
bors[bot]
b9d007d262
Merge #2988
2988: refactor(tests): Prepare for Special Type experiments r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-05 07:44:30 +00:00
bors[bot]
4dfa56a9e4
Merge #2989
2989: fix: Allow unicode aware case insensitivity r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-04 20:28:49 +00:00
Ed Page
78e4c90326 refactor(tests): Prepare for Special Type experiments
In experimenting on #1772, I want to write test cases for various
combinations of required or not, values vs occurrences, etc.  There
wasn't really a clear place to put these.

On top of that, I wanted there to be a clear place in the tests for
describing the behavior of special types, to make it easier to audit and
easier to see how a PR for #1772 changes things.

As part of this effort in organizing these tests, I reduced the number
of tests that use special types.  This better focuses these tests on the
cases they are intending to cover, rather than pulling in unrelated
features.  This makes it easier to audit special types and makes it so
failures give more focused results, making it easier to see what broke.
2021-11-04 13:12:01 -05:00
Ed Page
4b0048666a fix: Allow unicode aware case insensitivity
In #2985, I noticed #2834 was incomplete, there were case-insensitive
comparisons we were doing without being unicode aware (when compile
options are set).

The downside is that each comparison will require a UTF-8 validation.
These seem to be in more of corners of the API, rather than in common
calls in common usages, so hopefully that isn't too much of a problem.
2021-11-04 12:23:02 -05:00
bors[bot]
879dd23963
Merge #2986
2986: Revert #2950 to make sure we get it properly in #2985 r=epage a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2021-11-03 18:51:19 +00:00
Pavan Kumar Sunkara
98f696c0a6 Revert "Revert "docs: Clarify corner caseses with default values""
This reverts commit 4edcda2b99.
2021-11-03 18:27:12 +00:00
Pavan Kumar Sunkara
5e76e6c568 Revert "Added ArgMatcher::is_default_value abstraction"
This reverts commit 261a2c00e8.
2021-11-03 18:26:15 +00:00
Pavan Kumar Sunkara
736cb28dd0 Revert "Fixes group conflicting with arg which has default value"
This reverts commit 8c76556ac4.
2021-11-03 18:25:53 +00:00
Pavan Kumar Sunkara
706085d9c5 Revert "Fixes arg conflicting with group whose arg has default value"
This reverts commit 64a2866b09.
2021-11-03 18:25:25 +00:00
Pavan Kumar Sunkara
4e370bb093 Revert "Fixes group conflicting if two args with default values"
This reverts commit 01869744c2.
2021-11-03 18:24:50 +00:00
Pavan Kumar Sunkara
bd8c36cf04 Revert "Fixes arg and group with default value having requires"
This reverts commit 130dcbfdd9.
2021-11-03 18:22:19 +00:00
Pavan Kumar Sunkara
8818327b25 Revert "Fixes arg having required_if on default values"
This reverts commit a88562c12b.
2021-11-03 18:20:39 +00:00
Pavan Kumar Sunkara
6e85fb3ae0 Revert "Fixes arg having required_unless on default values"
This reverts commit ac1de1fc78.
2021-11-03 18:18:54 +00:00
bors[bot]
3cc46a1c83
Merge #2984
2984: fix: Switch sub-commands from multi-val to multi-occur r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-03 16:59:25 +00:00
Ed Page
8212647bb3 fix: Switch sub-commands from multi-val to multi-occur
Similar to #2977, this changes positional argument `<subcmd>` in
`help <subcmd>` to be multiple occurrences, from being multiple values.

This is what identified the usage generation bug fixed in #2978 and was
isolated into the test case `positional_multiple_occurrences_is_dotted`.

This is part of #2692 where we re-evaluate the usage of multiple values
for positionals now that we accept multiple occurrences.
2021-11-02 20:55:43 -05:00
bors[bot]
ae48175207
Merge #2977
2977: fix(usage)!: Switch positionals... from multi-val to mulit-occur r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-03 01:47:44 +00:00
bors[bot]
9365f6a0af
Merge #2907
2907: fix: Ease clap2->3 transition for Settings r=kbknapp a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-03 00:41:14 +00:00
bors[bot]
acaa3645c3
Merge #2980
2980: test: Easier to test with minimal features r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-02 22:02:31 +00:00
Ed Page
844251c478 test: Easier to test with minimal features
PR #2979 reduced what dependencies we push on users and made us one step
closer to being able to test more with fewer features.  Looks like I
also need to update `clap_derive`.  I verified locally that #2976 fails
with this.

`clap_derive` still needs `env` because of examples / tests that use it.
I feel like moving `clap_derive`s tests out to `clap` would be the way
to fix this.
2021-11-02 16:40:31 -05:00
Ed Page
a9c6a5b531 refactor(tests): Remove unnecessary color disabling
The tests are using `to_string` which maps to `Display::fmt` and the
`Colorizer` version is colorless.  To get color, it is only supported
with `print()` which has to go to stdout / stderr and can't be directed
to an arbitrary stream.
2021-11-02 16:40:31 -05:00
bors[bot]
bb396a1d51
Merge #2978
2978: fix: Always respect positional occurrences r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-02 20:44:53 +00:00
bors[bot]
c8acf5debd
Merge #2976
2976: fix: Loosen reflection lifetimes r=pksunkara a=epage



Co-authored-by: Ed Page <eopage@gmail.com>
2021-11-01 21:41:34 +00:00
Ed Page
ade6028da1 fix: Loosen reflection lifetimes
Though we store a lot of values as `&'help str`, we return them as
`&'self str`, making it so they can not be used programmatically as part
of a `App::mut_arg` call.

This loosens the lifetimes so they can be used with `App::mut_arg`.
This also includes a test simulating the desired workflow described in #2966

I skipped `get_all_aliases`.  I ran into problems with lifetimes with
`all_subcommand_names`  and didn't quickly resolve it.  Rather than hold
this up, I punted on it for now.

We'll have to tighten these back up with #1041 but that will also enable
turning them into owned strings, so this will still be possible after
that issue is resolved, just the calls will be slightly different.
2021-11-01 16:28:43 -05:00