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