From ea03e8a38bb9e7837f5a54129ed094df82a6d6be Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 18 Apr 2023 13:28:51 +0100 Subject: [PATCH] cli: add rad fork command Add a `rad fork` command to create a forked namespace, using the local peer, for the given repository. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-cli/src/commands.rs | 2 + radicle-cli/src/commands/fork.rs | 74 ++++++++++++++++++++++++++++++++ radicle-cli/src/commands/help.rs | 1 + radicle-cli/src/main.rs | 8 ++++ 4 files changed, 85 insertions(+) create mode 100644 radicle-cli/src/commands/fork.rs diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index f56768a3..746e683c 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -14,6 +14,8 @@ pub mod rad_delegate; pub mod rad_edit; #[path = "commands/fetch.rs"] pub mod rad_fetch; +#[path = "commands/fork.rs"] +pub mod rad_fork; #[path = "commands/help.rs"] pub mod rad_help; #[path = "commands/id.rs"] diff --git a/radicle-cli/src/commands/fork.rs b/radicle-cli/src/commands/fork.rs new file mode 100644 index 00000000..38208787 --- /dev/null +++ b/radicle-cli/src/commands/fork.rs @@ -0,0 +1,74 @@ +use std::ffi::OsString; +use std::path::Path; + +use anyhow::Context as _; + +use radicle::prelude::Id; +use radicle::rad; + +use crate::terminal as term; +use crate::terminal::args; +use crate::terminal::args::{Args, Error, Help}; + +pub const HELP: Help = Help { + name: "ls", + description: "Create a fork of a project", + version: env!("CARGO_PKG_VERSION"), + usage: r#" +Usage + + rad fork [] [