Skip to content

Commit 5736aad

Browse files
committed
fix(publish): Switch the 'ctrl-c on wait' line to a help message
Unsure if this should be two groups or one group with a message. If its one group, then we'll have a decorative line and then the `help:` will be further indented. I went with what is closer to how we do things today. We can always re-evaluate at a later point.
1 parent bd04a4c commit 5736aad

11 files changed

+118
-111
lines changed

src/cargo/ops/registry/publish.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,18 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
287287
let source_description = source.source_id().to_string();
288288
let short_pkg_descriptions = package_list(to_confirm.iter().copied(), "or");
289289
if plan.is_empty() {
290-
opts.gctx.shell().note(format!(
291-
"waiting for {short_pkg_descriptions} to be available at {source_description}.\n\
292-
You may press ctrl-c to skip waiting; the {crate} should be available shortly.",
293-
crate = if to_confirm.len() == 1 { "crate" } else {"crates"}
294-
))?;
290+
let report = &[
291+
annotate_snippets::Group::with_title(
292+
annotate_snippets::Level::NOTE
293+
.secondary_title(format!(
294+
"waiting for {short_pkg_descriptions} to be available at {source_description}"
295+
))),
296+
annotate_snippets::Group::with_title(annotate_snippets::Level::HELP.secondary_title(format!(
297+
"you may press ctrl-c to skip waiting; the {crate} should be available shortly",
298+
crate = if to_confirm.len() == 1 { "crate" } else {"crates"}
299+
))),
300+
];
301+
opts.gctx.shell().print_report(report, false)?;
295302
} else {
296303
opts.gctx.shell().note(format!(
297304
"waiting for {short_pkg_descriptions} to be available at {source_description}.\n\

tests/testsuite/alt_registry.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
362362
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
363363
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
364364
[UPLOADED] foo v0.0.1 to registry `alternative`
365-
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
366-
You may press ctrl-c to skip waiting; the crate should be available shortly.
365+
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`
366+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
367367
[PUBLISHED] foo v0.0.1 at registry `alternative`
368368
369369
"#]])
@@ -525,8 +525,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
525525
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
526526
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
527527
[UPLOADED] foo v0.0.1 to registry `alternative`
528-
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
529-
You may press ctrl-c to skip waiting; the crate should be available shortly.
528+
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`
529+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
530530
[PUBLISHED] foo v0.0.1 at registry `alternative`
531531
532532
"#]])
@@ -607,8 +607,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
607607
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
608608
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
609609
[UPLOADED] foo v0.0.1 to registry `alternative`
610-
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`.
611-
You may press ctrl-c to skip waiting; the crate should be available shortly.
610+
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`
611+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
612612
[PUBLISHED] foo v0.0.1 at registry `alternative`
613613
614614
"#]])

tests/testsuite/artifact_dep.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,8 +2261,8 @@ fn publish_artifact_dep() {
22612261
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
22622262
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
22632263
[UPLOADED] foo v0.1.0 to registry `crates-io`
2264-
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
2265-
You may press ctrl-c to skip waiting; the crate should be available shortly.
2264+
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`
2265+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
22662266
[PUBLISHED] foo v0.1.0 at registry `crates-io`
22672267
22682268
"#]])

tests/testsuite/cargo_features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
707707
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
708708
[UPLOADING] a v0.0.1 ([ROOT]/foo)
709709
[UPLOADED] a v0.0.1 to registry `crates-io`
710-
[NOTE] waiting for a v0.0.1 to be available at registry `crates-io`.
711-
You may press ctrl-c to skip waiting; the crate should be available shortly.
710+
[NOTE] waiting for a v0.0.1 to be available at registry `crates-io`
711+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
712712
[PUBLISHED] a v0.0.1 at registry `crates-io`
713713
714714
"#]])

tests/testsuite/credential_process.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ fn publish() {
8080
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
8181
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]"}
8282
[UPLOADED] foo v0.1.0 to registry `alternative`
83-
[NOTE] waiting for foo v0.1.0 to be available at registry `alternative`.
84-
You may press ctrl-c [..]
83+
[NOTE] waiting for foo v0.1.0 to be available at registry `alternative`
84+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
8585
[PUBLISHED] foo v0.1.0 at registry `alternative`
8686
8787
"#]])
@@ -564,7 +564,7 @@ fn token_caching() {
564564
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]"}
565565
[UPLOADED] foo v0.1.0 to registry `alternative`
566566
[NOTE] waiting [..]
567-
You may press ctrl-c [..]
567+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
568568
[PUBLISHED] foo v0.1.0 at registry `alternative`
569569
570570
"#]];
@@ -585,7 +585,7 @@ You may press ctrl-c [..]
585585
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.1","cksum":"[..]"}
586586
[UPLOADED] foo v0.1.1 to registry `alternative`
587587
[NOTE] waiting [..]
588-
You may press ctrl-c [..]
588+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
589589
[PUBLISHED] foo v0.1.1 at registry `alternative`
590590
591591
"#]];

tests/testsuite/cross_publish.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ fn publish_with_target() {
115115
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
116116
[UPLOADING] foo v0.0.0 ([ROOT]/foo)
117117
[UPLOADED] foo v0.0.0 to registry `crates-io`
118-
[NOTE] waiting for foo v0.0.0 to be available at registry `crates-io`.
119-
You may press ctrl-c to skip waiting; the crate should be available shortly.
118+
[NOTE] waiting for foo v0.0.0 to be available at registry `crates-io`
119+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
120120
[PUBLISHED] foo v0.0.0 at registry `crates-io`
121121
122122
"#]])

tests/testsuite/features_namespaced.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ fn publish_no_implicit() {
930930
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
931931
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
932932
[UPLOADED] foo v0.1.0 to registry `crates-io`
933-
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
934-
You may press ctrl-c to skip waiting; the crate should be available shortly.
933+
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`
934+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
935935
[PUBLISHED] foo v0.1.0 at registry `crates-io`
936936
937937
"#]])
@@ -1074,8 +1074,8 @@ fn publish() {
10741074
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
10751075
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
10761076
[UPLOADED] foo v0.1.0 to registry `crates-io`
1077-
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`.
1078-
You may press ctrl-c to skip waiting; the crate should be available shortly.
1077+
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`
1078+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
10791079
[PUBLISHED] foo v0.1.0 at registry `crates-io`
10801080
10811081
"#]])

tests/testsuite/inheritable_workspace_fields.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ fn inherit_own_workspace_fields() {
167167
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
168168
[UPLOADING] foo v1.2.3 ([ROOT]/foo)
169169
[UPLOADED] foo v1.2.3 to registry `crates-io`
170-
[NOTE] waiting for foo v1.2.3 to be available at registry `crates-io`.
171-
You may press ctrl-c to skip waiting; the crate should be available shortly.
170+
[NOTE] waiting for foo v1.2.3 to be available at registry `crates-io`
171+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
172172
[PUBLISHED] foo v1.2.3 at registry `crates-io`
173173
174174
"#]])
@@ -334,8 +334,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
334334
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
335335
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
336336
[UPLOADED] bar v0.2.0 to registry `crates-io`
337-
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
338-
You may press ctrl-c to skip waiting; the crate should be available shortly.
337+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
338+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
339339
[PUBLISHED] bar v0.2.0 at registry `crates-io`
340340
341341
"#]])
@@ -501,8 +501,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
501501
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
502502
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
503503
[UPLOADED] bar v0.2.0 to registry `crates-io`
504-
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
505-
You may press ctrl-c to skip waiting; the crate should be available shortly.
504+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
505+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
506506
[PUBLISHED] bar v0.2.0 at registry `crates-io`
507507
508508
"#]])
@@ -762,8 +762,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-lice
762762
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
763763
[UPLOADING] bar v1.2.3 ([ROOT]/foo/bar)
764764
[UPLOADED] bar v1.2.3 to registry `crates-io`
765-
[NOTE] waiting for bar v1.2.3 to be available at registry `crates-io`.
766-
You may press ctrl-c to skip waiting; the crate should be available shortly.
765+
[NOTE] waiting for bar v1.2.3 to be available at registry `crates-io`
766+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
767767
[PUBLISHED] bar v1.2.3 at registry `crates-io`
768768
769769
"#]])
@@ -936,8 +936,8 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
936936
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
937937
[UPLOADING] bar v0.2.0 ([ROOT]/foo/bar)
938938
[UPLOADED] bar v0.2.0 to registry `crates-io`
939-
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`.
940-
You may press ctrl-c to skip waiting; the crate should be available shortly.
939+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
940+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
941941
[PUBLISHED] bar v0.2.0 at registry `crates-io`
942942
943943
"#]])

0 commit comments

Comments
 (0)