Skip to main content

git_workflow/
cli.rs

1//! CLI argument parsing with clap
2
3use clap::{Parser, Subcommand};
4
5#[derive(Parser)]
6#[command(name = "gw")]
7#[command(about = "Git workflow CLI - type-safe worktree-aware git operations")]
8#[command(version)]
9pub struct Cli {
10    #[command(subcommand)]
11    pub command: Commands,
12
13    /// Show verbose output (git commands being run)
14    #[arg(short, long, global = true)]
15    pub verbose: bool,
16}
17
18#[derive(Subcommand)]
19pub enum Commands {
20    /// Switch to home branch and sync with origin/main
21    Home,
22
23    /// Create new branch from origin/main
24    New {
25        /// Name of the branch to create (e.g., feature/add-login)
26        branch: Option<String>,
27    },
28
29    /// Delete merged branch and return to home
30    Cleanup {
31        /// Branch to delete (defaults to current branch if not on home)
32        branch: Option<String>,
33    },
34
35    /// Show current repository state
36    Status,
37
38    /// Pause current work: WIP commit and return to home branch
39    Pause {
40        /// Optional message describing why work is paused
41        message: Option<String>,
42    },
43
44    /// Abandon current changes and return to home branch
45    Abandon,
46
47    /// Undo the last commit (soft reset HEAD~1)
48    Undo,
49
50    /// Sync current branch after base PR is merged (update base to main, rebase, force push)
51    Sync,
52}