claude_code_switcher/
cli.rs1use clap::{Args, Parser, Subcommand};
2use std::path::PathBuf;
3
4use crate::snapshots::SnapshotScope;
5
6#[derive(Parser)]
8#[command(about, version, author, long_about = None)]
9pub struct Cli {
10 #[command(subcommand)]
11 pub command: Commands,
12}
13
14#[derive(Subcommand)]
16pub enum Commands {
17 #[command(alias = "l", alias = "ls")]
19 List {
20 #[arg(long, short, help = "Show detailed information about each snapshot")]
22 verbose: bool,
23 },
24
25 #[command(alias = "s")]
27 Snap {
28 name: String,
30
31 #[arg(
33 long,
34 default_value = "common",
35 help = "Scope of settings to include in snapshot"
36 )]
37 scope: SnapshotScope,
38
39 #[arg(long, help = "Path to settings file (default: .claude/settings.json)")]
41 settings_path: Option<PathBuf>,
42
43 #[arg(long, help = "Description for the snapshot")]
45 description: Option<String>,
46
47 #[arg(long, help = "Overwrite existing snapshot with same name")]
49 overwrite: bool,
50 },
51
52 #[command(alias = "a")]
54 Apply {
55 target: String,
57
58 #[arg(long, default_value = "common", help = "Scope of settings to include")]
60 scope: SnapshotScope,
61
62 #[arg(long, help = "Override model setting")]
64 model: Option<String>,
65
66 #[arg(long, help = "Path to settings file (default: .claude/settings.json)")]
68 settings_path: Option<PathBuf>,
69
70 #[arg(long, help = "Create backup of current settings before applying")]
72 backup: bool,
73
74 #[arg(long, help = "Skip confirmation prompt")]
76 yes: bool,
77 },
78
79 #[command(alias = "rm", alias = "remove", alias = "del")]
81 Delete {
82 name: String,
84
85 #[arg(long, help = "Skip confirmation prompt")]
87 yes: bool,
88 },
89
90 #[command(subcommand)]
92 Credentials(CredentialCommands),
93}
94
95#[derive(Subcommand)]
97pub enum CredentialCommands {
98 #[command(alias = "ls")]
100 List,
101
102 #[command(alias = "rm")]
104 Delete {
105 id: String,
107 },
108
109 Clear {
111 #[arg(long, help = "Skip confirmation prompt")]
113 yes: bool,
114 },
115}
116
117#[derive(Args, Clone)]
119pub struct SnapArgs {
120 pub name: String,
122
123 #[arg(
125 long,
126 default_value = "common",
127 help = "Scope of settings to include in snapshot"
128 )]
129 pub scope: SnapshotScope,
130
131 #[arg(long, help = "Path to settings file (default: .claude/settings.json)")]
133 pub settings_path: Option<PathBuf>,
134
135 #[arg(long, help = "Description for the snapshot")]
137 pub description: Option<String>,
138
139 #[arg(long, help = "Overwrite existing snapshot with same name")]
141 pub overwrite: bool,
142}
143
144#[derive(Args, Clone)]
146pub struct ApplyArgs {
147 pub target: String,
149
150 #[arg(long, default_value = "common", help = "Scope of settings to include")]
152 pub scope: SnapshotScope,
153
154 #[arg(long, help = "Override model setting")]
156 pub model: Option<String>,
157
158 #[arg(long, help = "Path to settings file (default: .claude/settings.json)")]
160 pub settings_path: Option<PathBuf>,
161
162 #[arg(long, help = "Create backup of current settings before applying")]
164 pub backup: bool,
165
166 #[arg(long, help = "Skip confirmation prompt")]
168 pub yes: bool,
169}