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

Method shareCommand

apps/cli/src/vault.program.ts:505–546  ·  view source on GitHub ↗
(commandName: string, deprecated: boolean)

Source from the content-addressed store, hash-verified

503 }
504
505 private shareCommand(commandName: string, deprecated: boolean): Command {
506 return new Command(commandName)
507 .argument("<id>", "Object's globally unique `id`.")
508 .argument("<organizationId>", "Organization's globally unique `id`.")
509 .argument(
510 "[encodedJson]",
511 "Encoded json of an array of collection ids. Can also be piped into stdin.",
512 )
513 .description((deprecated ? "--DEPRECATED-- " : "") + "Move an item to an organization.")
514 .on("--help", () => {
515 writeLn("\n Examples:");
516 writeLn("");
517 writeLn(
518 " bw " +
519 commandName +
520 " 4af958ce-96a7-45d9-beed-1e70fabaa27a " +
521 "6d82949b-b44d-468a-adae-3f3bacb0ea32 WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==",
522 );
523 writeLn(
524 " echo '[\"974053d0-3b33-4b98-886e-fecf5c8dba96\"]' | bw encode | " +
525 "bw " +
526 commandName +
527 " 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32",
528 );
529 if (deprecated) {
530 writeLn("");
531 writeLn('--DEPRECATED See "bw move" for the current implementation--');
532 }
533 writeLn("", true);
534 })
535 .action(async (id, organizationId, encodedJson, cmd) => {
536 await this.exitIfLocked();
537 const command = new ShareCommand(
538 this.serviceContainer.cipherService,
539 this.serviceContainer.accountService,
540 this.serviceContainer.collectionService,
541 this.serviceContainer.organizationService,
542 );
543 const response = await command.run(id, organizationId, encodedJson);
544 this.processResponse(response);
545 });
546 }
547
548 private confirmCommand(): Command {
549 const confirmObjects = ["org-member"];

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