()
| 485 | } |
| 486 | |
| 487 | private importCommand(): Command { |
| 488 | return new Command("import") |
| 489 | .argument("[format]", "The format of [input]") |
| 490 | .argument("[input]", "Filepath to data to import") |
| 491 | .description("Import vault data from a file.") |
| 492 | .option("--formats", "List formats") |
| 493 | .option("--organizationid <organizationid>", "ID of the organization to import to.") |
| 494 | .on("--help", () => { |
| 495 | writeLn("\n Examples:"); |
| 496 | writeLn(""); |
| 497 | writeLn(" bw import --formats"); |
| 498 | writeLn(" bw import bitwardencsv ./from/source.csv"); |
| 499 | writeLn(" bw import keepass2xml keepass_backup.xml"); |
| 500 | writeLn( |
| 501 | " bw import --organizationid cf14adc3-aca5-4573-890a-f6fa231436d9 keepass2xml keepass_backup.xml", |
| 502 | ); |
| 503 | }) |
| 504 | .action(async (format, filepath, options) => { |
| 505 | await this.exitIfLocked(); |
| 506 | const command = new ImportCommand( |
| 507 | this.serviceContainer.importService, |
| 508 | this.serviceContainer.organizationService, |
| 509 | this.serviceContainer.syncService, |
| 510 | this.serviceContainer.accountService, |
| 511 | ); |
| 512 | const response = await command.run(format, filepath, options); |
| 513 | this.processResponse(response); |
| 514 | }); |
| 515 | } |
| 516 | |
| 517 | private exportCommand(): Command { |
| 518 | return new Command("export") |
no test coverage detected