1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-16 00:03:23 +00:00

share command

This commit is contained in:
Kyle Spearrin
2018-10-23 22:56:15 -04:00
parent ac9cf91002
commit 7e56a687e3
4 changed files with 93 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import { ListCommand } from './commands/list.command';
import { LockCommand } from './commands/lock.command';
import { LoginCommand } from './commands/login.command';
import { LogoutCommand } from './commands/logout.command';
import { ShareCommand } from './commands/share.command';
import { SyncCommand } from './commands/sync.command';
import { UnlockCommand } from './commands/unlock.command';
import { UpdateCommand } from './commands/update.command';
@@ -374,6 +375,38 @@ export class Program {
this.processResponse(response);
});
program
.command('share <id> <organizationId> [encodedJson]')
.description('Share an item to an organization.')
.on('--help', () => {
writeLn('\n Id:');
writeLn('');
writeLn(' Item\'s globally unique `id`.');
writeLn('');
writeLn(' Organization Id:');
writeLn('');
writeLn(' Organization\'s globally unique `id`.');
writeLn('');
writeLn(' Notes:');
writeLn('');
writeLn(' `encodedJson` can also be piped into stdin. `encodedJson` contains ' +
'an array of collection ids.');
writeLn('');
writeLn(' Examples:');
writeLn('');
writeLn(' bw share 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32 ' +
'WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==');
writeLn(' echo \'["974053d0-3b33-4b98-886e-fecf5c8dba96"]\' | bw encode | ' +
'bw share 4af958ce-96a7-45d9-beed-1e70fabaa27a 6d82949b-b44d-468a-adae-3f3bacb0ea32');
writeLn('', true);
})
.action(async (id, organizationId, encodedJson, cmd) => {
await this.exitIfLocked();
const command = new ShareCommand(this.main.cipherService);
const response = await command.run(id, organizationId, encodedJson, cmd);
this.processResponse(response);
});
program
.command('import [format] [input]')
.description('Import vault data from a file.')