From fb44af965324634cb741c40118abb80db004b2a0 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Thu, 20 Apr 2023 21:08:00 +0200 Subject: [PATCH] cli: implement the rad remote rm command Implementing the `rad remote rm` command in order to be able to remote a remote inside the radicle remote list. Signed-off-by: Vincenzo Palazzo --- radicle-cli/src/commands/remote/rm.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 radicle-cli/src/commands/remote/rm.rs diff --git a/radicle-cli/src/commands/remote/rm.rs b/radicle-cli/src/commands/remote/rm.rs new file mode 100644 index 00000000..fbe49383 --- /dev/null +++ b/radicle-cli/src/commands/remote/rm.rs @@ -0,0 +1,11 @@ +use crate::git; +use crate::terminal as term; + +pub fn run(repository: &git::Repository, name: &str) -> anyhow::Result<()> { + if !git::is_remote(repository, name)? { + anyhow::bail!("remote `{name}` not found"); + } + repository.remote_delete(name)?; + term::success!("Remote `{name}` removed"); + Ok(()) +}