()
| 622 | } |
| 623 | |
| 624 | private exportCommand(): Command { |
| 625 | return new Command("export") |
| 626 | .description("Export vault data to a CSV, JSON or ZIP file.") |
| 627 | .option("--output <output>", "Output directory or filename.") |
| 628 | .option("--format <format>", "Export file format.") |
| 629 | .option( |
| 630 | "--password [password]", |
| 631 | "Use password to encrypt instead of your Bitwarden account encryption key. Only applies to the encrypted_json format.", |
| 632 | ) |
| 633 | .option("--organizationid <organizationid>", "Organization id for an organization.") |
| 634 | .on("--help", () => { |
| 635 | writeLn("\n Notes:"); |
| 636 | writeLn(""); |
| 637 | writeLn( |
| 638 | " Valid formats are `csv`, `json`, `encrypted_json` and zip. Default format is `csv`.", |
| 639 | ); |
| 640 | writeLn(""); |
| 641 | writeLn( |
| 642 | " If --raw option is specified and no output filename or directory is given, the", |
| 643 | ); |
| 644 | writeLn(" result is written to stdout."); |
| 645 | writeLn(""); |
| 646 | writeLn(" Examples:"); |
| 647 | writeLn(""); |
| 648 | writeLn(" bw export"); |
| 649 | writeLn(" bw --raw export"); |
| 650 | writeLn(" bw export myPassword321"); |
| 651 | writeLn(" bw export myPassword321 --format json"); |
| 652 | writeLn(" bw export --output ./exp/bw.csv"); |
| 653 | writeLn(" bw export myPassword321 --output bw.json --format json"); |
| 654 | writeLn( |
| 655 | " bw export myPassword321 --organizationid 7063feab-4b10-472e-b64c-785e2b870b92", |
| 656 | ); |
| 657 | writeLn("", true); |
| 658 | }) |
| 659 | .action(async (options) => { |
| 660 | await this.exitIfLocked(); |
| 661 | const command = new ExportCommand( |
| 662 | this.serviceContainer.exportService, |
| 663 | this.serviceContainer.policyService, |
| 664 | this.serviceContainer.eventCollectionService, |
| 665 | this.serviceContainer.accountService, |
| 666 | ); |
| 667 | const response = await command.run(options); |
| 668 | this.processResponse(response); |
| 669 | }); |
| 670 | } |
| 671 | } |
no test coverage detected