()
| 474 | } |
| 475 | |
| 476 | private restoreCommand(): Command { |
| 477 | const restoreObjects = ["item"]; |
| 478 | return new Command("restore") |
| 479 | .argument("<object>", "Valid objects are: " + restoreObjects.join(", ")) |
| 480 | .argument("<id>", "Object's globally unique `id`.") |
| 481 | .description("Restores an object from the trash or archive.") |
| 482 | .on("--help", () => { |
| 483 | writeLn("\n Examples:"); |
| 484 | writeLn(""); |
| 485 | writeLn(" bw restore item 7063feab-4b10-472e-b64c-785e2b870b92"); |
| 486 | writeLn("", true); |
| 487 | }) |
| 488 | .action(async (object, id, cmd) => { |
| 489 | if (!this.validateObject(object, restoreObjects)) { |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | await this.exitIfLocked(); |
| 494 | const command = new RestoreCommand( |
| 495 | this.serviceContainer.cipherService, |
| 496 | this.serviceContainer.accountService, |
| 497 | this.serviceContainer.cipherAuthorizationService, |
| 498 | this.serviceContainer.cipherArchiveService, |
| 499 | ); |
| 500 | const response = await command.run(object, id); |
| 501 | this.processResponse(response); |
| 502 | }); |
| 503 | } |
| 504 | |
| 505 | private shareCommand(commandName: string, deprecated: boolean): Command { |
| 506 | return new Command(commandName) |
no test coverage detected