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, or that a
18    /// local integration or the trunk already carries; delete only the
19    /// proven ones, and only under --apply.
20    Prune {
21        /// The repository to read.
22        #[arg(long, default_value = ".")]
23        target: Utf8PathBuf,
24
25        /// Override the detected project path (owner/name) for the forge
26        /// confirmation.
27        #[arg(long)]
28        repo: Option<String>,
29
30        /// Override the detected forge: github or gitlab.
31        #[arg(long)]
32        forge: Option<String>,
33
34        /// Confirm each candidate against the forge's merged requests,
35        /// deleting nothing.
36        #[arg(long)]
37        verify: bool,
38
39        /// Confirm each candidate, then delete the confirmed branches
40        /// with git branch -D.
41        #[arg(long)]
42        apply: bool,
43
44        /// Print nothing when there is nothing to report, for the
45        /// post-merge hook.
46        #[arg(long, conflicts_with = "json")]
47        quiet: bool,
48
49        /// Emit one JSON object on stdout instead of the human report.
50        #[arg(long)]
51        json: bool,
52    },
53}