1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "gitfleet")]
#[command(about = "A Git submodule manager for synchronized superbranches", long_about = None)]
#[command(version)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
/// Enable verbose output
#[arg(short, long, global = true)]
pub verbose: bool,
/// Dry run mode (show what would happen without executing)
#[arg(short = 'n', long, global = true)]
pub dry_run: bool,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
/// Show status of all submodules
Status,
/// Checkout a branch across all submodules
Checkout {
/// Branch name to checkout
branch: String,
/// Create the branch if it doesn't exist
#[arg(short, long)]
create: bool,
},
/// Pull latest changes in all submodules
Pull {
/// Use rebase instead of merge
#[arg(short, long)]
rebase: bool,
},
/// Push changes in all submodules
Push {
/// Force push with lease
#[arg(short, long)]
force_with_lease: bool,
},
/// Create a new branch across all submodules
Create {
/// Branch name to create
branch: String,
/// Base branch to create from
#[arg(short, long)]
from: Option<String>,
/// Push the new branch immediately
#[arg(short, long)]
push: bool,
},
/// Commit changes across all submodules
Commit {
/// Commit message
#[arg(short, long)]
message: String,
/// Push after committing
#[arg(short, long)]
push: bool,
},
/// Synchronize all submodules based on .gitmodules
Sync {
/// Initialize missing submodules
#[arg(short, long)]
init: bool,
/// Recursive sync for nested submodules
#[arg(short, long)]
recursive: bool,
},
/// Delete a branch from all submodules
Delete {
/// Branch name to delete
branch: String,
/// Also delete from remote
#[arg(short, long)]
remote: bool,
/// Force delete
#[arg(short, long)]
force: bool,
},
/// Fetch updates for all submodules
Fetch {
/// Fetch from all remotes
#[arg(short, long)]
all: bool,
},
/// List branches across all submodules
Branch {
/// Show all branches including remotes
#[arg(short, long)]
all: bool,
},
/// Initialize all submodules
Init {
/// Recursively initialize nested submodules
#[arg(short, long)]
recursive: bool,
},
/// Generate per-file diffs for all submodules and superproject
Diff {
/// Base ref to diff against (commit, branch, tag). Without this, diffs unstaged changes.
#[arg(long)]
base: Option<String>,
/// Output directory for diff files
#[arg(short, long, default_value = "diffs")]
output: String,
/// Include staged changes (only when no base ref is given)
#[arg(short, long)]
staged: bool,
},
/// Stage all changes in all submodules and superproject
Stage,
/// Merge current branch back into main across all repos
MergeBack {
/// Commit message for staging uncommitted changes before merge
#[arg(short, long, default_value = "Pre-merge commit")]
message: String,
},
}