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 using global options before an alias. #7837

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Jan 26, 2020

Options before an alias were being ignored (like cargo -v b). The solution is to extract those global options before expanding an alias, and then merging it later.

An alternative to this is to try to avoid discarding the options during expansion, but I couldn't figure out a way to get the position of the subcommand in the argument list. Clap only provides a way to get the arguments following the subcommand.

I also cleaned up some of the code in Config::configure, which was carrying some weird baggage from previous refactorings.

Fixes #7834

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 26, 2020
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 28, 2020

📌 Commit 868c4d8 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 28, 2020
@bors
Copy link
Contributor

bors commented Jan 28, 2020

⌛ Testing commit 868c4d8 with merge 94c3938...

bors added a commit that referenced this pull request Jan 28, 2020
Fix using global options before an alias.

Options before an alias were being ignored (like `cargo -v b`).  The solution is to extract those global options before expanding an alias, and then merging it later.

An alternative to this is to try to avoid discarding the options during expansion, but I couldn't figure out a way to get the position of the subcommand in the argument list.  Clap only provides a way to get the arguments *following* the subcommand.

I also cleaned up some of the code in `Config::configure`, which was carrying some weird baggage from previous refactorings.

Fixes #7834
@bors
Copy link
Contributor

bors commented Jan 28, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 28, 2020
@ehuss ehuss force-pushed the fix-global-opt-alias branch from 868c4d8 to 0279e8e Compare January 31, 2020 21:56
@ehuss
Copy link
Contributor Author

ehuss commented Jan 31, 2020

Forgot to update the resolver tests.

@bors r=alexcrichton

@bors
Copy link
Contributor

bors commented Jan 31, 2020

📌 Commit 0279e8e has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 31, 2020
bors added a commit that referenced this pull request Jan 31, 2020
Fix using global options before an alias.

Options before an alias were being ignored (like `cargo -v b`).  The solution is to extract those global options before expanding an alias, and then merging it later.

An alternative to this is to try to avoid discarding the options during expansion, but I couldn't figure out a way to get the position of the subcommand in the argument list.  Clap only provides a way to get the arguments *following* the subcommand.

I also cleaned up some of the code in `Config::configure`, which was carrying some weird baggage from previous refactorings.

Fixes #7834
@bors
Copy link
Contributor

bors commented Jan 31, 2020

⌛ Testing commit 0279e8e with merge 972b9f5...

@bors
Copy link
Contributor

bors commented Jan 31, 2020

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 972b9f5 to master...

@bors bors merged commit 0279e8e into rust-lang:master Jan 31, 2020
@ehuss ehuss added this to the 1.43.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Options are silently ignored when using aliased commands
4 participants