codeberg_cli/actions/repo/branch/
delete.rs1use crate::actions::GlobalArgs;
2use crate::types::context::BergContext;
3use crate::types::git::OwnerRepo;
4
5use clap::Parser;
6use miette::IntoDiagnostic;
7
8#[derive(Parser, Debug)]
10pub struct RepoBranchDeleteArgs {
11 #[arg(value_name = "BRANCH")]
13 pub branch: String,
14}
15
16impl RepoBranchDeleteArgs {
17 pub async fn run(self, global_args: GlobalArgs) -> miette::Result<()> {
18 let ctx = BergContext::new(self, global_args).await?;
19
20 let OwnerRepo { repo, owner } = ctx.owner_repo()?;
21
22 ctx.client
23 .repo_delete_branch(owner.as_str(), repo.as_str(), ctx.args.branch.as_str())
24 .await
25 .into_diagnostic()?;
26
27 println!("Branch '{}' deleted successfully", ctx.args.branch);
28
29 Ok(())
30 }
31}