()
| 378 | } |
| 379 | |
| 380 | private restoreCommand(): Command { |
| 381 | const restoreObjects = ["item"]; |
| 382 | return new Command("restore") |
| 383 | .argument("<object>", "Valid objects are: " + restoreObjects.join(", ")) |
| 384 | .argument("<id>", "Object's globally unique `id`.") |
| 385 | .description("Restores an object from the trash or archive.") |
| 386 | .on("--help", () => { |
| 387 | writeLn("\n Examples:"); |
| 388 | writeLn(""); |
| 389 | writeLn(" bw restore item 7063feab-4b10-472e-b64c-785e2b870b92"); |
| 390 | writeLn("", true); |
| 391 | }) |
| 392 | .action(async (object, id, cmd) => { |
| 393 | if (!this.validateObject(object, restoreObjects)) { |
| 394 | return; |
| 395 | } |
| 396 | |
| 397 | await this.exitIfLocked(); |
| 398 | const command = new RestoreCommand( |
| 399 | this.serviceContainer.cipherService, |
| 400 | this.serviceContainer.accountService, |
| 401 | this.serviceContainer.cipherAuthorizationService, |
| 402 | this.serviceContainer.cipherArchiveService, |
| 403 | ); |
| 404 | const response = await command.run(object, id); |
| 405 | this.processResponse(response); |
| 406 | }); |
| 407 | } |
| 408 | |
| 409 | private shareCommand(commandName: string, deprecated: boolean): Command { |
| 410 | return new Command(commandName) |
no test coverage detected