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

Method importCommand

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

Source from the content-addressed store, hash-verified

581 }
582
583 private importCommand(): Command {
584 return new Command("import")
585 .argument("[format]", "The format of [input]")
586 .argument("[input]", "Filepath to data to import")
587 .description("Import vault data from a file.")
588 .option("--formats", "List formats")
589 .option("--organizationid <organizationid>", "ID of the organization to import to.")
590 .option("--keyfile <keyfile>", "Path to a key file used to unlock a KeePass (kdbx) database.")
591 .option(
592 "--passwordenv <passwordenv>",
593 "Environment variable storing the import file password.",
594 )
595 .option(
596 "--passwordfile <passwordfile>",
597 "Path to a file containing the import file password as its first line.",
598 )
599 .on("--help", () => {
600 writeLn("\n Examples:");
601 writeLn("");
602 writeLn(" bw import --formats");
603 writeLn(" bw import bitwardencsv ./from/source.csv");
604 writeLn(" bw import keepass2xml keepass_backup.xml");
605 writeLn(
606 " bw import --organizationid cf14adc3-aca5-4573-890a-f6fa231436d9 keepass2xml keepass_backup.xml",
607 );
608 })
609 .action(async (format, filepath, options) => {
610 await this.exitIfLocked();
611 const command = new ImportCommand(
612 this.serviceContainer.importService,
613 this.serviceContainer.organizationService,
614 this.serviceContainer.syncService,
615 this.serviceContainer.accountService,
616 this.serviceContainer.logService,
617 this.serviceContainer.i18nService,
618 );
619 const response = await command.run(format, filepath, options);
620 this.processResponse(response);
621 });
622 }
623
624 private exportCommand(): Command {
625 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