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

Make Command::args_overrides_self the default #4261

Open
epage opened this issue Sep 26, 2022 · 0 comments
Open

Make Command::args_overrides_self the default #4261

epage opened this issue Sep 26, 2022 · 0 comments
Labels
A-parsing Area: Parser's logic and needs it changed somehow. C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-decision Status: Waiting on a go/no-go before implementing

Comments

@epage
Copy link
Member

epage commented Sep 26, 2022

We had talked about swapping the default for 3.0 but punted.

When working on ArgAction during 3.2, I modeled it after Python's argparse which only supports overriding, making args_overrides_self the only behavior for the new actions.

When switching cargo to the new actions, some tests specifically checking for self-conflicts failed. This reminded me that in cargo 1.64.0, --target switched from a multiple_occurrences(false) to multiple_occurrences(true). This was a switch from an error case to a working case. If args_overrides_self had been on, it would have been a switch from a working case to a working case, being a change in working behavior.

We decided in 4.0.0 to defer a decision on the behavior and bring back args_overrides_self, making the new actions behave like the old ones,

So to summarize args_overrides_self(true)

  • Allows easy overriding of previous arguments, especially if args/aliases are involved
    • e.g. alias ls='ls -xyz' would be safe to repeat some of those flagd
  • Has compatibility hazards

So should we switch to it being on by default, only on, or maintain status quo?

Notes

@epage epage added C-enhancement Category: Raise on the bar on expectations S-waiting-on-decision Status: Waiting on a go/no-go before implementing A-parsing Area: Parser's logic and needs it changed somehow. labels Sep 26, 2022
epage added a commit to epage/clap that referenced this issue Sep 26, 2022
epage added a commit to epage/clap that referenced this issue Sep 26, 2022
@epage epage added the M-breaking-change Meta: Implementing or merging this will introduce a breaking change. label Sep 26, 2022
epage added a commit to epage/clap that referenced this issue Sep 28, 2022
epage added a commit to epage/clap that referenced this issue Sep 28, 2022
epage added a commit to epage/clap that referenced this issue Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parsing Area: Parser's logic and needs it changed somehow. C-enhancement Category: Raise on the bar on expectations M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-decision Status: Waiting on a go/no-go before implementing
Projects
None yet
Development

No branches or pull requests

1 participant