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
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "gitcore")]
#[command(version)]
#[command(about = "Manage multiple Git accounts safely with SSH keys", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Add a new git account
Add {
name: Option<String>,
platform: Option<String>,
},
/// List all configured accounts
List,
/// Clone a repo using a specific account
Clone { repo: Option<String> },
/// Test SSH connection to a provider
Test { name: Option<String> },
/// Manage git remotes for repositories
Remote {
#[command(subcommand)]
subcommand: RemoteCommands,
},
/// Create an encrypted backup of all accounts and keys
Backup { file: Option<String> },
/// Restore accounts and keys from a backup or JSON
Restore { file: Option<String> },
/// Remove an account from Gitcore
Remove { name: Option<String> },
/// Run security audit on keys and permissions
Audit,
/// Rotate the SSH key for an account
Rotate { name: Option<String> },
}
#[derive(Subcommand)]
pub enum RemoteCommands {
/// Add a remote URL using a specific account
Add { repo_url: Option<String> },
/// Switch existing remote to use a different account
Switch { account: Option<String> },
}