Description
Because I'm working on crates.io locally and testing out publish, and because I'm interested in being able to publish to a private registry in the future, it's annoying that I have to cargo login
again when I want to publish to crates.io again instead.
cargo login --help
shows a --host
option like cargo publish
has, but specifying my local crates.io index to cargo login --host
still overwrites all the content in ~/.cargo/config
.
It looks like the only thing --host
is used for right now is if you call cargo login
without a token: println!("please visit {}me and paste the API Token below", host);
Related to rust-lang/rfcs#2141, namely, I think this is similar to, but not dependent on, #4498 so that we can say cargo login --registry myregistry
and cargo will put this in .cargo/credentials
, which will match up with the registry configuration in .cargo/config
specified in rust-lang/rfcs#2141:
[registries.myregistry]
token = "abcdefg"
I think it could literally just append this to the file (replacing any existing token for registries.myregistry
; nicer would be if it complained if registries.myregistry
didn't appear in any .cargo/config
.
Although I guess it does depend on #4498 to actually be useful, since otherwise cargo wouldn't know when it should use this token :)