1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(
5 name = "gwt",
6 version,
7 author,
8 about = "Git worktree management tool",
9 long_about = "A tool for managing git worktrees efficiently with hooks and configuration support",
10 disable_version_flag = true
11)]
12pub struct Cli {
13 #[arg(short = 'v', long = "version", action = clap::ArgAction::Version)]
15 pub version: (),
16
17 #[command(subcommand)]
18 pub command: Commands,
19}
20
21#[derive(Subcommand)]
22pub enum CompletionAction {
23 Generate {
25 #[arg(value_enum)]
27 shell: clap_complete::Shell,
28 },
29 Install {
31 #[arg(value_enum)]
33 shell: Option<clap_complete::Shell>,
34 },
35}
36
37#[derive(Subcommand)]
38pub enum AuthAction {
39 Github,
41 BitbucketCloud {
43 #[command(subcommand)]
44 action: Option<BitbucketCloudAuthAction>,
45 },
46 BitbucketDataCenter {
48 #[command(subcommand)]
49 action: Option<BitbucketDataCenterAuthAction>,
50 },
51}
52
53#[derive(Subcommand)]
54pub enum BitbucketCloudAuthAction {
55 Setup,
57 Test,
59}
60
61#[derive(Subcommand)]
62pub enum BitbucketDataCenterAuthAction {
63 Setup,
65 Test,
67}
68
69#[derive(clap::ValueEnum, Clone, Debug)]
70pub enum Provider {
71 Github,
73 BitbucketCloud,
75 BitbucketDataCenter,
77}
78
79#[derive(Subcommand)]
80pub enum Commands {
81 Init {
83 repo_url: String,
85 #[arg(long, value_enum)]
87 provider: Option<Provider>,
88 #[arg(short, long)]
90 force: bool,
91 },
92
93 Add {
95 branch_name: String,
97 },
98
99 List {
101 #[arg(short, long)]
103 local: bool,
104 },
105
106 Remove {
108 branch_name: Option<String>,
110 #[arg(short, long)]
112 force: bool,
113 },
114
115 Auth {
117 #[command(subcommand)]
118 action: AuthAction,
119 },
120
121 Completions {
123 #[command(subcommand)]
125 action: Option<CompletionAction>,
126 },
127}