Skip to main content

release_kit/cli/
branches.rs

1//! Arguments for `rk branches`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand};
5
6/// Report and prune local branches the forge already merged.
7#[derive(Debug, Args)]
8pub struct BranchesArgs {
9    /// What to do with the local branches.
10    #[command(subcommand)]
11    pub action: BranchesAction,
12}
13
14/// The local-branch verbs.
15#[derive(Debug, Subcommand)]
16pub enum BranchesAction {
17    /// Report the local branches whose remote branch is gone; delete only
18    /// the forge-confirmed ones, and only under --apply.
19    Prune {
20        /// The repository to read.
21        #[arg(long, default_value = ".")]
22        target: Utf8PathBuf,
23
24        /// Override the detected project path (owner/name) for the forge
25        /// confirmation.
26        #[arg(long)]
27        repo: Option<String>,
28
29        /// Override the detected forge: github or gitlab.
30        #[arg(long)]
31        forge: Option<String>,
32
33        /// Confirm each candidate against the forge's merged requests,
34        /// deleting nothing.
35        #[arg(long)]
36        verify: bool,
37
38        /// Confirm each candidate, then delete the confirmed branches
39        /// with git branch -D.
40        #[arg(long)]
41        apply: bool,
42
43        /// Print nothing when there is nothing to report, for the
44        /// post-merge hook.
45        #[arg(long, conflicts_with = "json")]
46        quiet: bool,
47
48        /// Emit one JSON object on stdout instead of the human report.
49        #[arg(long)]
50        json: bool,
51    },
52}