If I do cargo publish --help, I see this documentation for the --host flag:
--host HOST Host to upload the package to
If I wanted to upload to the staging instance of crates.io at https://staging-crates-io.herokuapp.com/, the name of this flag and the docs make me think I should specify --host staging-crates-io.herokuapp.com here. This does not publish to the staging instance, however.
By digging into the code, I've figured out that what this flag actually wants is the location of the index to which I want to publish:
When I'm running crates.io locally, i'm able to publish to my local instance by giving cargo --host=file:///path/to/crates.io/tmp/index-co/. I'm able to get to a sort-of-working point with staging crates.io by specifying --host=https://github.com/alexcrichton/cargo-registry-index.
So I think that --host should be renamed to --index-url, or at the very least, the documentation in all the commands that use --host should explain that it should be a URL to the index you want to publish to.
If I do
cargo publish --help, I see this documentation for the--hostflag:If I wanted to upload to the staging instance of crates.io at https://staging-crates-io.herokuapp.com/, the name of this flag and the docs make me think I should specify
--host staging-crates-io.herokuapp.comhere. This does not publish to the staging instance, however.By digging into the code, I've figured out that what this flag actually wants is the location of the index to which I want to publish:
hostgets used in thePublishOpts.indexfieldindex.to_url(), which means it doesn't just want a host, it wants something that parses as a valid URLWhen I'm running crates.io locally, i'm able to publish to my local instance by giving cargo
--host=file:///path/to/crates.io/tmp/index-co/. I'm able to get to a sort-of-working point with staging crates.io by specifying--host=https://github.com/alexcrichton/cargo-registry-index.So I think that
--hostshould be renamed to--index-url, or at the very least, the documentation in all the commands that use--hostshould explain that it should be a URL to the index you want to publish to.