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