Skip to main content

release_kit/cli/
issue.rs

1//! Arguments for `rk issue`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand};
5
6/// Start work from a forge issue, with the forge naming the branch.
7#[derive(Debug, Args)]
8pub struct IssueArgs {
9    /// What to do with the issue.
10    #[command(subcommand)]
11    pub action: IssueAction,
12}
13
14/// The issue verbs. Unlike the worktree verbs, these read the recorded
15/// workflow mode: starting from an issue seats a worktree under one mode
16/// and checks out in place under the other.
17#[derive(Debug, Subcommand)]
18pub enum IssueAction {
19    /// Mint the issue's branch at the forge and seat it; preview by
20    /// default.
21    Start {
22        /// The issue: a number, `#<number>`, or the forge's issue URL.
23        issue: String,
24
25        /// The repository to act on; any of its worktrees names it.
26        #[arg(long, default_value = ".")]
27        target: Utf8PathBuf,
28
29        /// Override the detected forge: github or gitlab.
30        #[arg(long)]
31        forge: Option<String>,
32
33        /// Override the detected project path (owner/name).
34        #[arg(long)]
35        repo: Option<String>,
36
37        /// Override the recorded workflow mode: worktree or branches.
38        #[arg(long)]
39        workflow: Option<String>,
40
41        /// The remote branch the new branch starts from; the forge's
42        /// default branch where absent. GitHub takes a remote branch
43        /// name alone; GitLab also takes a commit SHA.
44        #[arg(long)]
45        base: Option<String>,
46
47        /// Mint and seat; without it the intent is reported and nothing
48        /// is touched, locally or on the forge.
49        #[arg(long)]
50        apply: bool,
51
52        /// Emit one JSON object on stdout instead of the human report.
53        #[arg(long)]
54        json: bool,
55    },
56}