31 lines
676 B
Rust
31 lines
676 B
Rust
mod args;
|
|
|
|
use anyhow::Context as _;
|
|
|
|
use radicle::rad;
|
|
|
|
use crate::{terminal as term, warning};
|
|
|
|
pub use args::Args;
|
|
|
|
pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
warning::deprecated("rad fork", "git push");
|
|
let profile = ctx.profile()?;
|
|
let signer = profile.signer()?;
|
|
let storage = &profile.storage;
|
|
|
|
let rid = match args.rid {
|
|
Some(rid) => rid,
|
|
None => {
|
|
let (_, rid) = rad::cwd().context("Current directory is not a Radicle repository")?;
|
|
|
|
rid
|
|
}
|
|
};
|
|
|
|
rad::fork(rid, &signer, &storage)?;
|
|
term::success!("Forked repository {rid} for {}", profile.id());
|
|
|
|
Ok(())
|
|
}
|