-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for a default registry for cargo commands #6135
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @sfackler, do you have any objections to this?
src/bin/cargo/command_prelude.rs
Outdated
@@ -359,9 +360,22 @@ pub trait ArgMatchesExt { | |||
requires -Zunstable-options to use." | |||
)); | |||
} | |||
Ok(Some(registry.to_string())) | |||
|
|||
if registry == "crates.io" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be one of the few places that we accept this string, right? If so, could the special casing not be done here and perhaps later in a more centralized location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit - crates-io
is used rather than crates.io
in [patch]
blocks so it might make sense to use the same here for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be one of the few places that we accept this string, right? If so, could the special casing not be done here and perhaps later in a more centralized location?
I have made the string a constant (and updated other uses of it), so it is now just doing a string comparison, I did consider moving the logic into source_id, but we don't always need the source (for example in publish), so I have left it where it was. Is that ok?
…h when registry is not specified
@bors: r+ |
📌 Commit 1fd3f1b has been approved by |
Add support for a default registry for cargo commands This adds two things: - --registry support for new and init - adds default registry configuration to cargo The main reason for these changes is to reduce the risk of closed-source software ending up accidentally on crates.io. This fixes #6123.
☀️ Test successful - status-appveyor, status-travis |
This adds two things:
The main reason for these changes is to reduce the risk of closed-source software ending up accidentally on crates.io.
This fixes #6123.