1
0
mirror of https://github.com/bitwarden/cli synced 2026-01-16 06:53:12 +00:00

Added --trash to delete cmd, added restore cmd

This commit is contained in:
Chad Scharf
2020-04-14 13:04:19 -04:00
parent 6e63a79cfd
commit 49f1fac3ed
8 changed files with 105 additions and 11 deletions

View File

@@ -66,6 +66,9 @@ export class ListCommand {
if (cmd.folderid != null || cmd.collectionid != null || cmd.organizationid != null) {
ciphers = ciphers.filter((c) => {
if (cmd.trash && !c.isDeleted) {
return false;
}
if (cmd.folderid != null) {
if (cmd.folderid === 'notnull' && c.folderId != null) {
return true;
@@ -100,10 +103,12 @@ export class ListCommand {
}
return false;
});
} else if (cmd.search == null || cmd.search.trim() === '') {
ciphers = ciphers.filter((c) => (cmd.trash || false) === c.isDeleted);
}
if (cmd.search != null && cmd.search.trim() !== '') {
ciphers = this.searchService.searchCiphersBasic(ciphers, cmd.search);
ciphers = this.searchService.searchCiphersBasic(ciphers, cmd.search, cmd.trash || false);
}
const res = new ListResponse(ciphers.map((o) => new CipherResponse(o)));