Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ease clap2->3 transition for Settings #2907

Merged
merged 3 commits into from
Nov 3, 2021
Merged

Conversation

epage
Copy link
Member

@epage epage commented Oct 18, 2021

This is handling non-behavior changes in Settings as part of #2617

@pksunkara
Copy link
Member

pksunkara commented Oct 18, 2021

We haven't decided on #2617 yet.

@epage epage force-pushed the 2to3-settings branch 3 times, most recently from 4003776 to 8ee7173 Compare October 26, 2021 19:27
epage added 3 commits October 27, 2021 13:07
This brings back the old name of settings, just deprecated.  Since they
all map to the same bits in the bit field, this should work for
`setting` and `is_set`.  The only thing this lacks is being able to do
equality across variants, whcih seems like a minority case.

Removed settings have some extra care abouts that we'll need to look
into separately.

This is a part of clap-rs#2617
This partiall reverts commit efeb02c,
bringing back the `AppSettins::Color*` and making them the backing store
for `App::color`, to help ease the transition from clap2->3.

Once we remove these deprecated settings, we might want to keep this
backing store to save on memory.

This is a part of clap-rs#2617
We prefer Settings to always be off by default, so when we change a
default, we have to rename.

This adds back in the now-default settings with deprecation messages to
help the user know how things now work.

Unfortunately, there is no way to notify the user that the default they
relied on has changed.  This also doesn't help us when the change in
behavior is more than just an inverting, like `InvalidUtf8` or when a
setting mapped to multiple bits.
@kbknapp
Copy link
Member

kbknapp commented Nov 3, 2021

I'm good with these changes. I think it will help the porting burden. We'll need to watch for any edge cases around the multiple handling, but overall this should help progress.

@pksunkara if we need to split off additional discussion in #2617 that isn't related to this PR or adding back in old, but compatible APIs with deprecation notices we can and probably should do that. I'm good with forwarding to new APIs with deprecation notices to make the porting process easier.

@kbknapp
Copy link
Member

kbknapp commented Nov 3, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 3, 2021

Build succeeded:

@bors bors bot merged commit 9365f6a into clap-rs:master Nov 3, 2021
@epage epage deleted the 2to3-settings branch November 3, 2021 02:01
epage added a commit to epage/clap that referenced this pull request Nov 11, 2021
In clap-rs#2851, we moved color from an AppSetting to function (with some
tweaks in clap-rs#2907).  When doing this, we documented `App::color` to be
equivelant of `App::global_settings(Color...)` but never actually
propogated it.

We are now propogating it.  A test is added to ensure that no matter
how we store the color choice, we continue to propogate it.  This
required exposing `App::get_color`.
epage added a commit to epage/clap that referenced this pull request Nov 11, 2021
In clap-rs#2851, we moved color from an AppSetting to function (with some
tweaks in clap-rs#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`.
@epage epage mentioned this pull request Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants