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
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(name = "etz", about = "Multi-repo worktree manager")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
/// Initialize .etz metadata in the current directory
Init,
/// Add a coordinated workspace backed by git worktrees
///
/// By default, new branches are created from each repo's default branch
/// (main/master). Use --from-current to branch from whatever is currently
/// checked out instead.
Add {
workspace: String,
#[arg(long)]
branch: String,
/// Branch from each repo's currently checked-out branch instead of its default (main/master)
#[arg(long, default_value_t = false)]
from_current: bool,
/// Copy .env* files from each source repo into its worktree
#[arg(long, default_value_t = false)]
copy_env: bool,
/// Do not copy non-repo root files/directories into the workspace root
#[arg(long, default_value_t = false)]
no_copy_root: bool,
},
/// List known workspaces
List,
/// Re-discover direct-child repos and refresh manifest metadata
Refresh {
/// Show drift only without writing manifest
#[arg(long)]
check: bool,
#[arg(long)]
json: bool,
},
/// Show workspace status
Status {
workspace: Option<String>,
/// Show only repos with changes
#[arg(long)]
changed: bool,
/// Print condensed totals instead of per-repo lines
#[arg(long)]
summary: bool,
#[arg(long)]
json: bool,
},
/// Commit staged or tracked changes across all repos in a workspace
Commit {
workspace: Option<String>,
#[arg(short = 'm', long, required_unless_present = "dry_run")]
message: Option<String>,
#[arg(long)]
all: bool,
#[arg(long)]
dry_run: bool,
#[arg(long)]
json: bool,
},
/// Push ahead commits for repos in a workspace
Push {
workspace: Option<String>,
#[arg(long)]
dry_run: bool,
#[arg(long)]
json: bool,
},
/// Remove a workspace and its worktrees
Remove {
workspace: String,
#[arg(long)]
force: bool,
},
/// Prune stale git worktree metadata and reconcile state
Prune,
/// Validate metadata and detect inconsistencies
Doctor {
#[arg(long)]
fix: bool,
#[arg(long)]
json: bool,
},
}