Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
}
}

// Print success note on publish
if opts.registry.is_none() {
if let Some(ref registries) = pkg.publish() {
if registries[0] == CRATES_IO_REGISTRY {
Comment on lines +249 to +251
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking only the first of the potential registries doesn't seem right.

We should instead check what registry we actually published to

if let Ok(packages) = opts.to_publish.get_packages(ws) {
for package in packages {
opts.config
.shell().note(format!("Your crate was successfully published to crates.io! You can visit it at https://crates.io/crates/{} .", package.name()))?
}
}
}
}
}

Comment on lines +248 to +261
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current cargo publish output isn't very helpful or gives a lot of feedback.

It's something like:
And that's it, it ends with a boring "Updating index" message. I

The message you showed I'm assuming is from a stable release. As you saw in the test, master already ends with

    Updating crates.io index
   Packaging delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Packaged 3 files, 761.0B (569.0B compressed)
   Uploading delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
    Uploaded delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo)
note: Waiting for `[email protected]` to be available at registry `crates-io`.
You may press ctrl-c to skip waiting; the crate should be available shortly.
     Waiting [===>                       ] 11/60
   Published delay v0.0.2 (/Users/eric/Proj/rust/cargo/target/tmp/cit/t0/foo) has been successfully published to registry `crates-io`

See #11713

Adding another success message feels a bit excessive in the amount of output we are showing the user.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right. I guess I just have a weird / old version (I made the issue in February, maybe the stable ver. there has changed a lot?)

Anyways, I'm going to close the PR

Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
note: Waiting [..]
You may press ctrl-c [..]
[PUBLISHED] foo v0.0.1 [..]
",
note: Your crate was successfully published to crates.io! You can visit it at https://crates.io/crates/foo .",
)
.run();
}
Expand Down