| fce44ae9 Andy McCall ↶ |
1 |
|
| 2 |
|
| 3 |
mod format; |
| 4 |
mod identity; |
| 5 |
mod sync; |
| 135212de Andy McCall ↶ |
6 |
pub mod ui; |
| fce44ae9 Andy McCall ↶ |
7 |
mod workspace; |
| 8 |
|
| 9 |
use anyhow::{Context, Result}; |
| 10 |
use clap::{Parser, Subcommand}; |
| 11 |
use oxy_core::repo::Repo; |
| 12 |
use std::path::PathBuf; |
| 13 |
|
| 14 |
#[derive(Parser)] |
| 15 |
#[command(name = "oxy", version, about = "Oxygen: breathing fresh air into version control")] |
| 16 |
struct Cli { |
| 135212de Andy McCall ↶ |
17 |
|
| 18 |
#[arg(long, global = true)] |
| 19 |
plain: bool, |
| fce44ae9 Andy McCall ↶ |
20 |
#[command(subcommand)] |
| 21 |
cmd: Cmd, |
| 22 |
} |
| 23 |
|
| 24 |
#[derive(Subcommand)] |
| 25 |
enum Cmd { |
| 26 |
|
| 27 |
Init { path: Option<PathBuf> }, |
| 28 |
|
| b3c5a59a Andy McCall ↶ |
29 |
Clone { |
| 30 |
url: String, |
| 31 |
dest: Option<PathBuf>, |
| 32 |
|
| 33 |
#[arg(long)] |
| 34 |
max_blob: Option<String>, |
| 7421309f Andy McCall ↶ |
35 |
|
| 36 |
#[arg(long = "sparse")] |
| 37 |
sparse: Vec<String>, |
| 2863456a Andy McCall ↶ |
38 |
|
| 39 |
#[arg(long)] |
| 40 |
depth: Option<u32>, |
| b3c5a59a Andy McCall ↶ |
41 |
}, |
| 2863456a Andy McCall ↶ |
42 |
|
| 43 |
Deepen { |
| 44 |
#[arg(default_value_t = 10)] |
| 45 |
depth: u32, |
| 46 |
#[arg(long, default_value = "origin")] |
| 47 |
remote: String, |
| 48 |
}, |
| 7421309f Andy McCall ↶ |
49 |
|
| 50 |
Sparse { paths: Vec<String> }, |
| fce44ae9 Andy McCall ↶ |
51 |
|
| 50a046e4 Andy McCall ↶ |
52 |
Status { |
| 53 |
|
| 54 |
#[arg(long)] |
| 55 |
json: bool, |
| 56 |
}, |
| 135212de Andy McCall ↶ |
57 |
|
| 58 |
Prompt { |
| 694805cc Andy McCall ↶ |
59 |
|
| 135212de Andy McCall ↶ |
60 |
#[arg(long, default_value = oxy_core::repo::DEFAULT_PROMPT_FORMAT)] |
| 61 |
format: String, |
| 694805cc Andy McCall ↶ |
62 |
|
| 63 |
#[arg(long)] |
| 64 |
glyphs: bool, |
| 65 |
|
| 66 |
#[arg(long, value_parser = ["raw", "bash", "zsh"])] |
| 67 |
color: Option<String>, |
| 135212de Andy McCall ↶ |
68 |
}, |
| fce44ae9 Andy McCall ↶ |
69 |
|
| 70 |
Commit { |
| 71 |
#[arg(short, long)] |
| 72 |
message: String, |
| 73 |
|
| 74 |
#[arg(long = "depends-on")] |
| 75 |
depends_on: Vec<String>, |
| 957fee30 Andy McCall ↶ |
76 |
|
| 77 |
paths: Vec<String>, |
| 78 |
|
| 79 |
#[arg(short, long)] |
| 80 |
interactive: bool, |
| fce44ae9 Andy McCall ↶ |
81 |
}, |
| 957fee30 Andy McCall ↶ |
82 |
|
| 83 |
Blame { |
| 84 |
path: String, |
| 85 |
#[arg(long)] |
| 86 |
json: bool, |
| 87 |
}, |
| 88 |
|
| 89 |
Bisect { |
| 90 |
#[command(subcommand)] |
| 91 |
cmd: BisectCmd, |
| 92 |
}, |
| fce44ae9 Andy McCall ↶ |
93 |
|
| 94084087 Andy McCall ↶ |
94 |
Log { |
| 95 |
|
| 96 |
#[arg(short = 'n', long)] |
| 97 |
limit: Option<usize>, |
| 98 |
|
| 99 |
#[arg(short, long)] |
| 100 |
verbose: bool, |
| 101 |
}, |
| fce44ae9 Andy McCall ↶ |
102 |
|
| 103 |
Diff, |
| 614541c3 Andy McCall ↶ |
104 |
|
| 105 |
Describe { |
| 106 |
#[arg(short, long)] |
| 107 |
message: String, |
| 108 |
change: Option<String>, |
| 109 |
}, |
| 23b217d7 Andy McCall ↶ |
110 |
|
| 614541c3 Andy McCall ↶ |
111 |
Amend { |
| 112 |
#[arg(short, long)] |
| 113 |
message: Option<String>, |
| 23b217d7 Andy McCall ↶ |
114 |
|
| 115 |
#[arg(long)] |
| 116 |
into: Option<String>, |
| 614541c3 Andy McCall ↶ |
117 |
}, |
| 23b217d7 Andy McCall ↶ |
118 |
|
| 119 |
Split { |
| 120 |
change: String, |
| 121 |
paths: Vec<String>, |
| 122 |
}, |
| 614541c3 Andy McCall ↶ |
123 |
|
| 124 |
Abandon { change: String }, |
| fce44ae9 Andy McCall ↶ |
125 |
|
| 126 |
Show { change: String }, |
| 127 |
|
| 128 |
Checkout { |
| 129 |
changes: Vec<String>, |
| 130 |
|
| 131 |
#[arg(long)] |
| 132 |
discard: bool, |
| 133 |
}, |
| 134 |
|
| 135 |
Resolve, |
| 136 |
|
| 137 |
Undo, |
| 252e8cb2 Andy McCall ↶ |
138 |
|
| 139 |
Checkpoint, |
| ba160f60 Andy McCall ↶ |
140 |
|
| 141 |
Gc { |
| 142 |
|
| 143 |
#[arg(long)] |
| 144 |
now: bool, |
| 145 |
}, |
| fce44ae9 Andy McCall ↶ |
146 |
|
| 147 |
#[command(name = "op")] |
| 148 |
Op { |
| 149 |
#[command(subcommand)] |
| 150 |
cmd: OpCmd, |
| 151 |
}, |
| cdb5beba Andy McCall ↶ |
152 |
|
| 153 |
Lock { path: String }, |
| 154 |
|
| 155 |
Unlock { path: String }, |
| 4e88e774 Andy McCall ↶ |
156 |
|
| 157 |
Workspace { |
| 158 |
#[command(subcommand)] |
| 159 |
cmd: WorkspaceCmd, |
| 160 |
}, |
| 7b9809e6 Andy McCall ↶ |
161 |
|
| 162 |
Bookmark { |
| 163 |
#[command(subcommand)] |
| 164 |
cmd: BookmarkCmd, |
| 165 |
}, |
| 166 |
|
| 167 |
Merge { bookmark: String }, |
| 4dee277c Andy McCall ↶ |
168 |
|
| 169 |
Submodule { |
| 170 |
#[command(subcommand)] |
| 171 |
cmd: SubmoduleCmd, |
| 172 |
}, |
| 132b884b Andy McCall ↶ |
173 |
|
| 174 |
Tag { |
| 175 |
#[command(subcommand)] |
| 176 |
cmd: TagCmd, |
| 177 |
}, |
| fce44ae9 Andy McCall ↶ |
178 |
|
| 179 |
Remote { |
| 180 |
#[command(subcommand)] |
| 181 |
cmd: RemoteCmd, |
| 182 |
}, |
| 183 |
|
| 184 |
Fetch { remote: Option<String> }, |
| 185 |
|
| 186 |
Pull { remote: Option<String> }, |
| 187 |
|
| 188 |
Push { |
| 189 |
remote: Option<String>, |
| 190 |
|
| 191 |
#[arg(long)] |
| 192 |
force: bool, |
| 7b9809e6 Andy McCall ↶ |
193 |
|
| 194 |
#[arg(short = 'b', long)] |
| 195 |
bookmark: Option<String>, |
| fce44ae9 Andy McCall ↶ |
196 |
}, |
| 2b5ee371 Andy McCall ↶ |
197 |
|
| fce44ae9 Andy McCall ↶ |
198 |
Serve { |
| 199 |
|
| 200 |
#[arg(long, default_value = ".")] |
| 201 |
root: PathBuf, |
| 202 |
#[arg(long, default_value = "127.0.0.1:8890")] |
| 203 |
bind: String, |
| 204 |
|
| 205 |
#[arg(long = "token")] |
| 206 |
tokens: Vec<String>, |
| 2b5ee371 Andy McCall ↶ |
207 |
|
| 208 |
#[arg(long, requires = "tls_key")] |
| 209 |
tls_cert: Option<PathBuf>, |
| 210 |
|
| 211 |
#[arg(long, requires = "tls_cert")] |
| 212 |
tls_key: Option<PathBuf>, |
| fce44ae9 Andy McCall ↶ |
213 |
}, |
| 214 |
|
| 215 |
Identity { |
| 216 |
#[command(subcommand)] |
| 217 |
cmd: IdentityCmd, |
| 218 |
}, |
| 219 |
|
| 220 |
Verify { change: Option<String> }, |
| 79ab8528 Andy McCall ↶ |
221 |
|
| 222 |
Git { |
| 223 |
#[command(subcommand)] |
| 224 |
cmd: GitCmd, |
| 225 |
}, |
| 83e0677b Andy McCall ↶ |
226 |
|
| 227 |
Policy { |
| 228 |
#[command(subcommand)] |
| 229 |
cmd: PolicyCmd, |
| 230 |
}, |
| 7421309f Andy McCall ↶ |
231 |
|
| fce44ae9 Andy McCall ↶ |
232 |
Config { |
| 233 |
key: String, |
| 234 |
value: String, |
| 235 |
|
| 236 |
#[arg(long)] |
| 237 |
user: bool, |
| 238 |
}, |
| 239 |
} |
| 240 |
|
| 241 |
#[derive(Subcommand)] |
| 242 |
enum OpCmd { |
| 243 |
Log, |
| 244 |
} |
| 245 |
|
| 246 |
#[derive(Subcommand)] |
| 4e88e774 Andy McCall ↶ |
247 |
enum WorkspaceCmd { |
| 248 |
|
| 249 |
Add { path: PathBuf, changes: Vec<String> }, |
| 250 |
List, |
| 251 |
|
| 252 |
Forget { workspace: String }, |
| 253 |
} |
| 254 |
|
| 255 |
#[derive(Subcommand)] |
| 957fee30 Andy McCall ↶ |
256 |
enum BisectCmd { |
| 257 |
|
| 258 |
Start, |
| 259 |
|
| 260 |
Good { changes: Vec<String> }, |
| 261 |
|
| 262 |
Bad { changes: Vec<String> }, |
| 263 |
|
| 264 |
Skip, |
| 265 |
|
| 266 |
Run { |
| 267 |
#[arg(required = true, trailing_var_arg = true)] |
| 268 |
command: Vec<String>, |
| 269 |
}, |
| 270 |
|
| 271 |
Status, |
| 272 |
|
| 273 |
Reset, |
| 274 |
} |
| 275 |
|
| 276 |
#[derive(Subcommand)] |
| 7b9809e6 Andy McCall ↶ |
277 |
enum BookmarkCmd { |
| 278 |
|
| 279 |
Create { name: String, changes: Vec<String> }, |
| 280 |
|
| 281 |
Set { name: String, changes: Vec<String> }, |
| 282 |
|
| 283 |
Delete { name: String }, |
| 284 |
|
| 285 |
List, |
| 286 |
|
| 287 |
Switch { |
| 288 |
name: String, |
| 289 |
|
| 290 |
#[arg(long)] |
| 291 |
discard: bool, |
| 292 |
}, |
| 293 |
} |
| 294 |
|
| 295 |
#[derive(Subcommand)] |
| 4dee277c Andy McCall ↶ |
296 |
enum SubmoduleCmd { |
| 297 |
|
| 298 |
Add { |
| 299 |
url: String, |
| 300 |
path: String, |
| 301 |
|
| 302 |
#[arg(long)] |
| 303 |
bookmark: Option<String>, |
| 304 |
}, |
| 305 |
|
| 306 |
Update { |
| 307 |
|
| 308 |
#[arg(long)] |
| 309 |
init: bool, |
| 310 |
paths: Vec<String>, |
| 311 |
}, |
| 312 |
|
| 313 |
Status, |
| 314 |
|
| 315 |
Remove { path: String }, |
| 316 |
} |
| 317 |
|
| 318 |
#[derive(Subcommand)] |
| 132b884b Andy McCall ↶ |
319 |
enum TagCmd { |
| 320 |
|
| 321 |
Create { |
| 322 |
name: String, |
| 323 |
changes: Vec<String>, |
| 324 |
#[arg(short, long, default_value = "")] |
| 325 |
message: String, |
| 326 |
}, |
| 327 |
List, |
| 328 |
} |
| 329 |
|
| 330 |
#[derive(Subcommand)] |
| fce44ae9 Andy McCall ↶ |
331 |
enum RemoteCmd { |
| 332 |
Add { name: String, url: String }, |
| 333 |
Remove { name: String }, |
| 334 |
List, |
| 335 |
} |
| 336 |
|
| 337 |
#[derive(Subcommand)] |
| 338 |
enum IdentityCmd { |
| 339 |
|
| 340 |
Create { |
| 341 |
#[arg(long)] |
| 342 |
name: Option<String>, |
| 343 |
#[arg(long)] |
| 344 |
email: Option<String>, |
| 345 |
|
| 346 |
#[arg(long)] |
| 347 |
local: bool, |
| 28fc23d7 Andy McCall ↶ |
348 |
|
| 349 |
#[arg(long)] |
| 350 |
expires: Option<u64>, |
| fce44ae9 Andy McCall ↶ |
351 |
}, |
| 352 |
|
| 353 |
Show, |
| 83e0677b Andy McCall ↶ |
354 |
|
| 355 |
Export { path: Option<PathBuf> }, |
| 28fc23d7 Andy McCall ↶ |
356 |
|
| 357 |
Rotate, |
| 358 |
|
| 359 |
Renew { |
| 360 |
#[arg(long)] |
| 361 |
expires: u64, |
| 362 |
}, |
| 363 |
|
| 364 |
Revoke { |
| 365 |
|
| 366 |
key: Option<String>, |
| 367 |
#[arg(long, default_value = "")] |
| 368 |
reason: String, |
| 369 |
}, |
| 370 |
|
| 371 |
Delegate { |
| 372 |
#[command(subcommand)] |
| 373 |
cmd: DelegateCmd, |
| 374 |
}, |
| 375 |
} |
| 376 |
|
| 377 |
#[derive(Subcommand)] |
| 378 |
enum DelegateCmd { |
| 379 |
|
| 380 |
Add { identity_file: PathBuf }, |
| 381 |
|
| 382 |
Remove { key: String }, |
| 383 |
|
| 384 |
List, |
| fce44ae9 Andy McCall ↶ |
385 |
} |
| 386 |
|
| 83e0677b Andy McCall ↶ |
387 |
#[derive(Subcommand)] |
| 79ab8528 Andy McCall ↶ |
388 |
enum GitCmd { |
| 389 |
|
| 30ea9c1e Andy McCall ↶ |
390 |
Export { |
| 391 |
git_dir: PathBuf, |
| 392 |
|
| 393 |
#[arg(long)] |
| 394 |
branch: Option<String>, |
| 395 |
}, |
| 396 |
|
| 397 |
Fetch { |
| 398 |
url: String, |
| 399 |
#[arg(long, default_value = "main")] |
| 400 |
branch: String, |
| 401 |
}, |
| 402 |
|
| 403 |
Push { |
| 404 |
url: String, |
| 405 |
#[arg(long, default_value = "main")] |
| 406 |
branch: String, |
| 407 |
}, |
| c3069537 Andy McCall ↶ |
408 |
|
| 409 |
Import { |
| 410 |
git_dir: PathBuf, |
| 411 |
dest: PathBuf, |
| 412 |
#[arg(long, default_value = "main")] |
| 413 |
branch: String, |
| 414 |
}, |
| 79ab8528 Andy McCall ↶ |
415 |
} |
| 416 |
|
| 417 |
#[derive(Subcommand)] |
| 83e0677b Andy McCall ↶ |
418 |
enum PolicyCmd { |
| 419 |
|
| 420 |
Init, |
| 421 |
|
| 422 |
Show, |
| 423 |
|
| 424 |
Grant { |
| 425 |
identity_file: PathBuf, |
| 426 |
|
| 427 |
#[arg(long)] |
| 428 |
pattern: Option<String>, |
| 28fc23d7 Andy McCall ↶ |
429 |
|
| 430 |
#[arg(long)] |
| 431 |
out: Option<PathBuf>, |
| 83e0677b Andy McCall ↶ |
432 |
}, |
| 433 |
|
| 28fc23d7 Andy McCall ↶ |
434 |
Revoke { |
| 435 |
key: String, |
| 436 |
|
| 437 |
#[arg(long)] |
| 438 |
out: Option<PathBuf>, |
| 439 |
}, |
| 440 |
|
| 441 |
Root { |
| 442 |
#[command(subcommand)] |
| 443 |
cmd: RootCmd, |
| 444 |
}, |
| 445 |
|
| 446 |
Sign { |
| 447 |
proposal: PathBuf, |
| 448 |
|
| 449 |
#[arg(long)] |
| 450 |
out: Option<PathBuf>, |
| 451 |
}, |
| 452 |
} |
| 453 |
|
| 454 |
#[derive(Subcommand)] |
| 455 |
enum RootCmd { |
| 456 |
|
| 457 |
Add { |
| 458 |
identity_file: PathBuf, |
| 459 |
#[arg(long)] |
| 460 |
out: Option<PathBuf>, |
| 461 |
}, |
| 462 |
|
| 463 |
Remove { |
| 464 |
key: String, |
| 465 |
#[arg(long)] |
| 466 |
out: Option<PathBuf>, |
| 467 |
}, |
| 468 |
|
| 469 |
Threshold { |
| 470 |
n: u32, |
| 471 |
#[arg(long)] |
| 472 |
out: Option<PathBuf>, |
| 473 |
}, |
| 83e0677b Andy McCall ↶ |
474 |
} |
| 475 |
|
| fce44ae9 Andy McCall ↶ |
476 |
|
| 477 |
fn open() -> Result<Repo> { |
| 478 |
Repo::open(&std::env::current_dir()?).context("opening repository") |
| 479 |
} |
| 480 |
|
| 481 |
|
| 482 |
pub fn run() -> Result<i32> { |
| 483 |
let cli = Cli::parse(); |
| 135212de Andy McCall ↶ |
484 |
ui::init(cli.plain); |
| fce44ae9 Andy McCall ↶ |
485 |
match cli.cmd { |
| 486 |
Cmd::Init { path } => workspace::init(path), |
| 50a046e4 Andy McCall ↶ |
487 |
Cmd::Status { json } => workspace::status(json), |
| 694805cc Andy McCall ↶ |
488 |
Cmd::Prompt { format, glyphs, color } => workspace::prompt(&format, glyphs, color.as_deref()), |
| 957fee30 Andy McCall ↶ |
489 |
Cmd::Commit { message, depends_on, paths, interactive } => workspace::commit(&message, &depends_on, &paths, interactive), |
| 490 |
Cmd::Blame { path, json } => workspace::blame(&path, json), |
| 491 |
Cmd::Bisect { cmd } => match cmd { |
| 492 |
BisectCmd::Start => workspace::bisect_start(), |
| 493 |
BisectCmd::Good { changes } => workspace::bisect_mark(Some(true), &changes), |
| 494 |
BisectCmd::Bad { changes } => workspace::bisect_mark(Some(false), &changes), |
| 495 |
BisectCmd::Skip => workspace::bisect_mark(None, &[]), |
| 496 |
BisectCmd::Run { command } => workspace::bisect_run(&command), |
| 497 |
BisectCmd::Status => workspace::bisect_status(), |
| 498 |
BisectCmd::Reset => workspace::bisect_reset(), |
| 499 |
}, |
| 94084087 Andy McCall ↶ |
500 |
Cmd::Log { limit, verbose } => workspace::log(limit, verbose), |
| fce44ae9 Andy McCall ↶ |
501 |
Cmd::Diff => workspace::diff(), |
| 614541c3 Andy McCall ↶ |
502 |
Cmd::Describe { message, change } => workspace::describe(&message, change.as_deref()), |
| 23b217d7 Andy McCall ↶ |
503 |
Cmd::Amend { message, into } => workspace::amend(message.as_deref(), into.as_deref()), |
| 504 |
Cmd::Split { change, paths } => workspace::split(&change, &paths), |
| 614541c3 Andy McCall ↶ |
505 |
Cmd::Abandon { change } => workspace::abandon(&change), |
| fce44ae9 Andy McCall ↶ |
506 |
Cmd::Show { change } => workspace::show(&change), |
| 507 |
Cmd::Checkout { changes, discard } => workspace::checkout(&changes, discard), |
| 508 |
Cmd::Resolve => workspace::resolve(), |
| 509 |
Cmd::Undo => workspace::undo(), |
| ba160f60 Andy McCall ↶ |
510 |
Cmd::Gc { now } => workspace::gc(now), |
| 252e8cb2 Andy McCall ↶ |
511 |
Cmd::Checkpoint => workspace::checkpoint(), |
| fce44ae9 Andy McCall ↶ |
512 |
Cmd::Op { cmd: OpCmd::Log } => workspace::op_log(), |
| 2863456a Andy McCall ↶ |
513 |
Cmd::Clone { url, dest, max_blob, sparse, depth } => sync::clone(&url, dest, max_blob.as_deref(), &sparse, depth), |
| 514 |
Cmd::Deepen { depth, remote } => sync::deepen(&remote, depth), |
| 7421309f Andy McCall ↶ |
515 |
Cmd::Sparse { paths } => workspace::sparse(&paths), |
| cdb5beba Andy McCall ↶ |
516 |
Cmd::Lock { path } => workspace::lock(&path), |
| 517 |
Cmd::Unlock { path } => workspace::unlock(&path), |
| 4e88e774 Andy McCall ↶ |
518 |
Cmd::Workspace { cmd } => match cmd { |
| 519 |
WorkspaceCmd::Add { path, changes } => workspace::workspace_add(&path, &changes), |
| 520 |
WorkspaceCmd::List => workspace::workspace_list(), |
| 521 |
WorkspaceCmd::Forget { workspace } => workspace::workspace_forget(&workspace), |
| 522 |
}, |
| 7b9809e6 Andy McCall ↶ |
523 |
Cmd::Bookmark { cmd } => match cmd { |
| 524 |
BookmarkCmd::Create { name, changes } => workspace::bookmark_create(&name, &changes), |
| 525 |
BookmarkCmd::Set { name, changes } => workspace::bookmark_set(&name, &changes), |
| 526 |
BookmarkCmd::Delete { name } => workspace::bookmark_delete(&name), |
| 527 |
BookmarkCmd::List => workspace::bookmark_list(), |
| 528 |
BookmarkCmd::Switch { name, discard } => workspace::bookmark_switch(&name, discard), |
| 529 |
}, |
| 530 |
Cmd::Merge { bookmark } => workspace::merge(&bookmark), |
| 4dee277c Andy McCall ↶ |
531 |
Cmd::Submodule { cmd } => match cmd { |
| 532 |
SubmoduleCmd::Add { url, path, bookmark } => sync::submodule_add(&url, &path, bookmark.as_deref()), |
| 533 |
SubmoduleCmd::Update { init, paths } => sync::submodule_update(init, &paths), |
| 534 |
SubmoduleCmd::Status => sync::submodule_status(), |
| 535 |
SubmoduleCmd::Remove { path } => sync::submodule_remove(&path), |
| 536 |
}, |
| 132b884b Andy McCall ↶ |
537 |
Cmd::Tag { cmd } => match cmd { |
| 538 |
TagCmd::Create { name, changes, message } => workspace::tag_create(&name, &changes, &message), |
| 539 |
TagCmd::List => workspace::tag_list(), |
| 540 |
}, |
| fce44ae9 Andy McCall ↶ |
541 |
Cmd::Remote { cmd } => match cmd { |
| 542 |
RemoteCmd::Add { name, url } => sync::remote_add(&name, &url), |
| 543 |
RemoteCmd::Remove { name } => sync::remote_remove(&name), |
| 544 |
RemoteCmd::List => sync::remote_list(), |
| 545 |
}, |
| 546 |
Cmd::Fetch { remote } => sync::fetch(remote.as_deref()), |
| 547 |
Cmd::Pull { remote } => sync::pull(remote.as_deref()), |
| 7b9809e6 Andy McCall ↶ |
548 |
Cmd::Push { remote, force, bookmark } => sync::push(remote.as_deref(), force, bookmark.as_deref()), |
| 2b5ee371 Andy McCall ↶ |
549 |
Cmd::Serve { root, bind, tokens, tls_cert, tls_key } => sync::serve(root, &bind, tokens, tls_cert.zip(tls_key)), |
| fce44ae9 Andy McCall ↶ |
550 |
Cmd::Identity { cmd } => match cmd { |
| 28fc23d7 Andy McCall ↶ |
551 |
IdentityCmd::Create { name, email, local, expires } => identity::create(name, email, local, expires), |
| fce44ae9 Andy McCall ↶ |
552 |
IdentityCmd::Show => identity::show(), |
| 83e0677b Andy McCall ↶ |
553 |
IdentityCmd::Export { path } => identity::export(path), |
| 28fc23d7 Andy McCall ↶ |
554 |
IdentityCmd::Rotate => identity::rotate(), |
| 555 |
IdentityCmd::Renew { expires } => identity::renew(expires), |
| 556 |
IdentityCmd::Revoke { key, reason } => identity::revoke(key.as_deref(), &reason), |
| 557 |
IdentityCmd::Delegate { cmd } => match cmd { |
| 558 |
DelegateCmd::Add { identity_file } => identity::delegate_add(&identity_file), |
| 559 |
DelegateCmd::Remove { key } => identity::delegate_remove(&key), |
| 560 |
DelegateCmd::List => identity::delegate_list(), |
| 561 |
}, |
| 83e0677b Andy McCall ↶ |
562 |
}, |
| 30ea9c1e Andy McCall ↶ |
563 |
Cmd::Git { cmd: GitCmd::Export { git_dir, branch } } => sync::git_export(&git_dir, branch.as_deref()), |
| 564 |
Cmd::Git { cmd: GitCmd::Fetch { url, branch } } => sync::git_fetch(&url, &branch), |
| 565 |
Cmd::Git { cmd: GitCmd::Push { url, branch } } => sync::git_push(&url, &branch), |
| c3069537 Andy McCall ↶ |
566 |
Cmd::Git { cmd: GitCmd::Import { git_dir, dest, branch } } => sync::git_import(&git_dir, &dest, &branch), |
| 83e0677b Andy McCall ↶ |
567 |
Cmd::Policy { cmd } => match cmd { |
| 568 |
PolicyCmd::Init => identity::policy_init(), |
| 569 |
PolicyCmd::Show => identity::policy_show(), |
| 28fc23d7 Andy McCall ↶ |
570 |
PolicyCmd::Grant { identity_file, pattern, out } => identity::policy_grant(&identity_file, pattern.as_deref(), out), |
| 571 |
PolicyCmd::Revoke { key, out } => identity::policy_revoke(&key, out), |
| 572 |
PolicyCmd::Root { cmd } => match cmd { |
| 573 |
RootCmd::Add { identity_file, out } => identity::policy_root_add(&identity_file, out), |
| 574 |
RootCmd::Remove { key, out } => identity::policy_root_remove(&key, out), |
| 575 |
RootCmd::Threshold { n, out } => identity::policy_threshold(n, out), |
| 576 |
}, |
| 577 |
PolicyCmd::Sign { proposal, out } => identity::policy_sign(&proposal, out), |
| fce44ae9 Andy McCall ↶ |
578 |
}, |
| 579 |
Cmd::Verify { change } => identity::verify(change.as_deref()), |
| 580 |
Cmd::Config { key, value, user } => identity::config(&key, &value, user), |
| 581 |
} |
| 582 |
} |