From 8e9cf90f46ad51a1c2bf42eb0bf0c2e9442d66d6 Mon Sep 17 00:00:00 2001 From: Aurelia Date: Wed, 15 Jan 2025 15:57:12 +0100 Subject: [PATCH] [cli] Fixup shared recovery progress display. --- cli/src/commands/invite/claim.rs | 18 ++++++++++++++++-- newsfragments/6090.feature.rst | 1 + newsfragments/9109.bugfix.rst | 2 +- newsfragments/9189.feature.rst | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 newsfragments/6090.feature.rst delete mode 100644 newsfragments/9189.feature.rst diff --git a/cli/src/commands/invite/claim.rs b/cli/src/commands/invite/claim.rs index 5987fd3bcaf..c497ee7c8b6 100644 --- a/cli/src/commands/invite/claim.rs +++ b/cli/src/commands/invite/claim.rs @@ -155,7 +155,21 @@ fn shamir_pick_recipient( ctx: &ShamirRecoveryClaimPickRecipientCtx, ) -> anyhow::Result { let recipients = ctx.recipients_without_a_share(); - let human_recipients: Vec<&_> = recipients.iter().map(|r| &r.human_handle).collect(); + let human_recipients: Vec<_> = recipients + .iter() + .map(|r| format!("{} - {} share(s)", r.human_handle, r.shares)) + .collect(); + if ctx.retrieved_shares().is_empty() { + println!("{} shares needed for recovery", ctx.threshold()); + } else { + println!( + "Out of {} shares needed for recovery, {} were retrieved.", + ctx.threshold(), + ctx.retrieved_shares() + .iter() + .fold(0_u8, |acc, (_, s)| acc + u8::from(*s)) + ); + } let selection = Select::new() .default(0) .with_prompt("Choose a person to contact now") @@ -346,7 +360,7 @@ async fn step4_device(ctx: DeviceClaimInProgress3Ctx) -> anyhow::Result anyhow::Result { diff --git a/newsfragments/6090.feature.rst b/newsfragments/6090.feature.rst new file mode 100644 index 00000000000..7e061f0cbe1 --- /dev/null +++ b/newsfragments/6090.feature.rst @@ -0,0 +1 @@ +Port the shared recovery feature (based on the Shamir algorithm) and expose it through the CLI. diff --git a/newsfragments/9109.bugfix.rst b/newsfragments/9109.bugfix.rst index c94e747e26a..002b0afc7bb 100644 --- a/newsfragments/9109.bugfix.rst +++ b/newsfragments/9109.bugfix.rst @@ -1 +1 @@ -[CLI] Stop spinners with check mark. +Stop spinners with check mark. diff --git a/newsfragments/9189.feature.rst b/newsfragments/9189.feature.rst deleted file mode 100644 index adf1fa5c659..00000000000 --- a/newsfragments/9189.feature.rst +++ /dev/null @@ -1 +0,0 @@ -The CLI command ``invite shared-recovery`` now take the email as an argument instead of an option