Allow to force the deletion of branches
This commit is contained in:
parent
61bf3d4542
commit
4ad1e3310b
1 changed files with 9 additions and 1 deletions
10
src/main.rs
10
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<String>,
|
||||
}
|
||||
|
|
@ -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()?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue