From 4ad1e3310bd9f4f8d9b85b5dd77cd4f61fc21e59 Mon Sep 17 00:00:00 2001 From: Quentin Boyer Date: Tue, 7 May 2024 13:43:37 +0200 Subject: [PATCH] Allow to force the deletion of branches --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b532bff..7a3d04d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,6 +48,9 @@ struct Delete { /// Only delete the local branch of the series #[arg(short, long)] local_only: bool, + /// Force the deletion of the branch (-D) + #[arg(short, long)] + force: bool, /// Branch to delete (defaults to the current branch) branch: Option, } @@ -580,7 +583,12 @@ fn main() -> Result<()> { ])?; } - git_cd(&["branch", "-d", branch])?; + let branch_delete = match delete.force { + true => "-D", + false => "-d", + }; + + git_cd(&["branch", branch_delete, branch])?; let branch_dir = patch_dir.join(&branch); std::fs::remove_dir_all(branch_dir).into_diagnostic()?;