MCPcopy Create free account
hub / github.com/bitwarden/clients / importCommand

Method importCommand

apps/cli/src/vault.program.ts:487–526  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 .option("--keyfile <keyfile>", "Path to a key file used to unlock a KeePass (kdbx) database.")
495 .option(
496 "--passwordenv <passwordenv>",
497 "Environment variable storing the import file password.",
498 )
499 .option(
500 "--passwordfile <passwordfile>",
501 "Path to a file containing the import file password as its first line.",
502 )
503 .on("--help", () => {
504 writeLn("\n Examples:");
505 writeLn("");
506 writeLn(" bw import --formats");
507 writeLn(" bw import bitwardencsv ./from/source.csv");
508 writeLn(" bw import keepass2xml keepass_backup.xml");
509 writeLn(
510 " bw import --organizationid cf14adc3-aca5-4573-890a-f6fa231436d9 keepass2xml keepass_backup.xml",
511 );
512 })
513 .action(async (format, filepath, options) => {
514 await this.exitIfLocked();
515 const command = new ImportCommand(
516 this.serviceContainer.importService,
517 this.serviceContainer.organizationService,
518 this.serviceContainer.syncService,
519 this.serviceContainer.accountService,
520 this.serviceContainer.logService,
521 this.serviceContainer.i18nService,
522 );
523 const response = await command.run(format, filepath, options);
524 this.processResponse(response);
525 });
526 }
527
528 private exportCommand(): Command {
529 return new Command("export")

Callers 1

registerMethod · 0.95

Calls 4

runMethod · 0.95
actionMethod · 0.80
descriptionMethod · 0.45
processResponseMethod · 0.45

Tested by

no test coverage detected