Skip to content

Commit c0148fa

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 24bb93c commit c0148fa

11 files changed

+172
-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: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,9 @@ 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+
|
367+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
367368
[PUBLISHED] foo v0.0.1 at registry `alternative`
368369
369370
"#]])
@@ -525,8 +526,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
525526
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
526527
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
527528
[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.
529+
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`
530+
|
531+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
530532
[PUBLISHED] foo v0.0.1 at registry `alternative`
531533
532534
"#]])
@@ -607,8 +609,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
607609
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
608610
[UPLOADING] foo v0.0.1 ([ROOT]/foo)
609611
[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.
612+
[NOTE] waiting for foo v0.0.1 to be available at registry `alternative`
613+
|
614+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
612615
[PUBLISHED] foo v0.0.1 at registry `alternative`
613616
614617
"#]])

tests/testsuite/artifact_dep.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,8 +2261,9 @@ 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+
|
2266+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
22662267
[PUBLISHED] foo v0.1.0 at registry `crates-io`
22672268
22682269
"#]])

tests/testsuite/cargo_features.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,9 @@ 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+
|
712+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
712713
[PUBLISHED] a v0.0.1 at registry `crates-io`
713714
714715
"#]])

tests/testsuite/credential_process.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ 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+
|
85+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
8586
[PUBLISHED] foo v0.1.0 at registry `alternative`
8687
8788
"#]])
@@ -564,7 +565,8 @@ fn token_caching() {
564565
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.0","cksum":"[..]"}
565566
[UPLOADED] foo v0.1.0 to registry `alternative`
566567
[NOTE] waiting [..]
567-
You may press ctrl-c [..]
568+
|
569+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
568570
[PUBLISHED] foo v0.1.0 at registry `alternative`
569571
570572
"#]];
@@ -585,7 +587,8 @@ You may press ctrl-c [..]
585587
{"v":1,"registry":{"index-url":"[..]","name":"alternative"},"kind":"get","operation":"publish","name":"foo","vers":"0.1.1","cksum":"[..]"}
586588
[UPLOADED] foo v0.1.1 to registry `alternative`
587589
[NOTE] waiting [..]
588-
You may press ctrl-c [..]
590+
|
591+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
589592
[PUBLISHED] foo v0.1.1 at registry `alternative`
590593
591594
"#]];

tests/testsuite/cross_publish.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ 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+
|
120+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
120121
[PUBLISHED] foo v0.0.0 at registry `crates-io`
121122
122123
"#]])

tests/testsuite/features_namespaced.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,9 @@ 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+
|
935+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
935936
[PUBLISHED] foo v0.1.0 at registry `crates-io`
936937
937938
"#]])
@@ -1074,8 +1075,9 @@ fn publish() {
10741075
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
10751076
[UPLOADING] foo v0.1.0 ([ROOT]/foo)
10761077
[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.
1078+
[NOTE] waiting for foo v0.1.0 to be available at registry `crates-io`
1079+
|
1080+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
10791081
[PUBLISHED] foo v0.1.0 at registry `crates-io`
10801082
10811083
"#]])

tests/testsuite/inheritable_workspace_fields.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ 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+
|
172+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
172173
[PUBLISHED] foo v1.2.3 at registry `crates-io`
173174
174175
"#]])
@@ -334,8 +335,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
334335
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
335336
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
336337
[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.
338+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
339+
|
340+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
339341
[PUBLISHED] bar v0.2.0 at registry `crates-io`
340342
341343
"#]])
@@ -501,8 +503,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
501503
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
502504
[UPLOADING] bar v0.2.0 ([ROOT]/foo)
503505
[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.
506+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
507+
|
508+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
506509
[PUBLISHED] bar v0.2.0 at registry `crates-io`
507510
508511
"#]])
@@ -762,8 +765,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-lice
762765
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
763766
[UPLOADING] bar v1.2.3 ([ROOT]/foo/bar)
764767
[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.
768+
[NOTE] waiting for bar v1.2.3 to be available at registry `crates-io`
769+
|
770+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
767771
[PUBLISHED] bar v1.2.3 at registry `crates-io`
768772
769773
"#]])
@@ -936,8 +940,9 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
936940
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
937941
[UPLOADING] bar v0.2.0 ([ROOT]/foo/bar)
938942
[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.
943+
[NOTE] waiting for bar v0.2.0 to be available at registry `crates-io`
944+
|
945+
[HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
941946
[PUBLISHED] bar v0.2.0 at registry `crates-io`
942947
943948
"#]])

0 commit comments

Comments
 (0)