radicle_cli/commands/
block.rs1mod args;
2
3use radicle::node::policy::Policy;
4
5use crate::terminal as term;
6
7use term::args::BlockTarget;
8
9pub use args::Args;
10
11pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
12 let profile = ctx.profile()?;
13 let mut policies = profile.policies_mut()?;
14
15 let updated = match args.target {
16 BlockTarget::Node(nid) => policies.set_follow_policy(&nid, Policy::Block)?,
17 BlockTarget::Repo(rid) => policies.set_seed_policy(&rid, Policy::Block)?,
18 };
19 if updated {
20 term::success!("Policy for {} set to 'block'", args.target);
21 }
22 Ok(())
23}