1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-15 15:53:44 +00:00

add list items --url <url> command. resolves #32

This commit is contained in:
Kyle Spearrin
2018-10-13 22:27:33 -04:00
parent 4639aa613e
commit 73c597f649
7 changed files with 35 additions and 24 deletions

View File

@@ -1,5 +1,7 @@
import * as program from 'commander';
import { CipherView } from 'jslib/models/view/cipherView';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service';
@@ -36,7 +38,12 @@ export class ListCommand {
}
private async listCiphers(cmd: program.Command) {
let ciphers = await this.cipherService.getAllDecrypted();
let ciphers: CipherView[];
if (cmd.url != null && cmd.url.trim() !== '') {
ciphers = await this.cipherService.getAllDecryptedForUrl(cmd.url);
} else {
ciphers = await this.cipherService.getAllDecrypted();
}
if (cmd.folderid != null || cmd.collectionid != null || cmd.organizationid != null) {
ciphers = ciphers.filter((c) => {