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

Method shareCommand

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

Source from the content-addressed store, hash-verified

407 }
408
409 private shareCommand(commandName: string, deprecated: boolean): Command {
410 return new Command(commandName)
411 .argument("<id>", "Object's globally unique `id`.")
412 .argument("<organizationId>", "Organization's globally unique `id`.")
413 .argument(
414 "[encodedJson]",
415 "Encoded json of an array of collection ids. Can also be piped into stdin.",
416 )
417 .description((deprecated ? "--DEPRECATED-- " : "") + "Move an item to an organization.")
418 .on("--help", () => {
419 writeLn("\n Examples:");
420 writeLn("");
421 writeLn(
422 " bw " +
423 commandName +
424 " 4af958ce-96a7-45d9-beed-1e70fabaa27a " +
425 "6d82949b-b44d-468a-adae-3f3bacb0ea32 WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==",
426 );
427 writeLn(
428 " echo '[\"974053d0-3b33-4b98-886e-fecf5c8dba96\"]' | bw encode | " +
429 "bw " +
430 commandName +
431 " 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32",
432 );
433 if (deprecated) {
434 writeLn("");
435 writeLn('--DEPRECATED See "bw move" for the current implementation--');
436 }
437 writeLn("", true);
438 })
439 .action(async (id, organizationId, encodedJson, cmd) => {
440 await this.exitIfLocked();
441 const command = new ShareCommand(
442 this.serviceContainer.cipherService,
443 this.serviceContainer.accountService,
444 this.serviceContainer.collectionService,
445 this.serviceContainer.organizationService,
446 );
447 const response = await command.run(id, organizationId, encodedJson);
448 this.processResponse(response);
449 });
450 }
451
452 private confirmCommand(): Command {
453 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