Skip to main content

radicle_cli/commands/
fork.rs

1mod args;
2
3use anyhow::Context as _;
4
5use radicle::rad;
6
7use crate::{terminal as term, warning};
8
9pub use args::Args;
10
11pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
12    warning::deprecated("rad fork", "git push");
13    let profile = ctx.profile()?;
14    let signer = profile.signer()?;
15    let storage = &profile.storage;
16
17    let rid = match args.rid {
18        Some(rid) => rid,
19        None => {
20            let (_, rid) = rad::cwd().context("Current directory is not a Radicle repository")?;
21
22            rid
23        }
24    };
25
26    rad::fork(rid, &signer, &storage)?;
27    term::success!("Forked repository {rid} for {}", profile.id());
28
29    Ok(())
30}