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 checkout mode: linked-worktree or
38        /// main-worktree.
39        #[arg(long = "checkout-mode", alias = "workflow", value_name = "MODE")]
40        workflow: Option<String>,
41
42        /// The remote branch the new branch starts from; the forge's
43        /// default branch where absent. GitHub takes a remote branch
44        /// name alone; GitLab also takes a commit SHA.
45        #[arg(long)]
46        base: Option<String>,
47
48        /// Mint and seat; without it the intent is reported and nothing
49        /// is touched, locally or on the forge.
50        #[arg(long)]
51        apply: bool,
52
53        /// Emit one JSON object on stdout instead of the human report.
54        #[arg(long)]
55        json: bool,
56    },
57}