From 3018223328d566c003e2bf37959302c6f314be42 Mon Sep 17 00:00:00 2001 From: Sekhat Temporus Date: Fri, 25 Apr 2025 23:28:19 +0100 Subject: [PATCH] cli: Allow multiple RIDs for `rad unseed` To keep expectations similar to the seed command after the changes in the companion patch: rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/patch/3be0e68b8948e65431a288f225454bafd93de34a --- radicle-cli/examples/rad-unseed-many.md | 22 ++++++++++++++++++++++ radicle-cli/src/commands/unseed.rs | 20 ++++++++++++-------- radicle-cli/tests/commands.rs | 20 ++++++++++++++++++++ 3 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 radicle-cli/examples/rad-unseed-many.md diff --git a/radicle-cli/examples/rad-unseed-many.md b/radicle-cli/examples/rad-unseed-many.md new file mode 100644 index 00000000..edeca073 --- /dev/null +++ b/radicle-cli/examples/rad-unseed-many.md @@ -0,0 +1,22 @@ +It is possible to use the `rad unseed` command to specify multiple RIDs at the +same time, where each repository specified will stop being seeded. + +Let's say we have multiple local repositories we've initialized: + +``` +$ rad ls +╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Name RID Visibility Head Description │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ heartwood rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji public f2de534 Radicle Heartwood Protocol & Stack │ +│ nixpkgs rad:zyFFr2iwoTEfNF4jGNZHuoy7odMh public f2de534 Home for Nix Packages │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +``` + +We could stop seeding them if we didn't want other nodes to fetch them from us: + +``` +$ rad unseed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji rad:zyFFr2iwoTEfNF4jGNZHuoy7odMh +✓ Seeding policy for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji removed +✓ Seeding policy for rad:zyFFr2iwoTEfNF4jGNZHuoy7odMh removed +``` diff --git a/radicle-cli/src/commands/unseed.rs b/radicle-cli/src/commands/unseed.rs index ca4c7df8..04d64fc7 100644 --- a/radicle-cli/src/commands/unseed.rs +++ b/radicle-cli/src/commands/unseed.rs @@ -1,6 +1,7 @@ use std::ffi::OsString; use anyhow::anyhow; +use nonempty::NonEmpty; use radicle::{prelude::*, Node}; @@ -14,10 +15,10 @@ pub const HELP: Help = Help { usage: r#" Usage - rad unseed [